Home Forums Plugin Support WP User Frontend Pro Drop down to set post formats –please confirm this code

This topic is: not resolved

This topic contains 2 replies, has 3 voices, and was last updated by  Nayem 3 years, 8 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #69299

    Chardon
    Member
    Post count: 10

    I was searching for a solution for users to see post format options and found this post in the wordpress support for the free version….how do I get this to work with the pro version?

    Found on https://wordpress.org/support/topic/plugin-wp-user-frontend-set-post_format-when-adding-post?replies=3#post-3709483

    // Add the drop-down (you can edit the list of post format options)
    function wpufe_content_type( $post_type, $post = null) {
    
        ?>
        <li>
            <label for="post_format">Content Type<span class="required">*</span></label>
            <select class="requiredField" name="content_type" id="content_type">
            	<option value="" selected="selected">What are you posting?</option>
                <option value="standard">Text (Blog Post)</option>
                <option value="image">Single Image</option>
                <option value="gallery">Gallery of Images</option>
                <option value="video">Video</option>
                <option value="audio">Audio</option>
            </select>
            <div class="clear"></div>
        </li>
        <?php
    }
    
    add_action( 'wpuf_add_post_form_top', 'wpufe_content_type', 10, 2 );
    
    // Validate the data (optional)
    function wpufe_content_type_validation( $errors ) {
        if( $_POST['content_type'] == '' ) {
            $errors[] = 'Please select a Content Type.';
        }
    
        return $errors;
    }
    add_filter( 'wpuf_add_post_validation', 'wpufe_content_type_validation' );
    
    // Make it happen!
    function wpufe_add_content_type( $post_id ) {
    	set_post_format( $post_id, $_POST['content_type'] );
    }
    add_action( 'wpuf_add_post_after_insert', 'wpufe_add_content_type' );
    #69344

    towhid
    Participant
    Post count: 4505

    Hello Chardon,

    I am really sorry to say that I can not help you despite my desire.

    I am really sorry to say we are unable to provide any possible solution due to a heavy pressure. We have lots of pending task in our queue. My suggestion will be please hire an experienced developer and get the work done for you.

    Thanks

    #69350

    Nayem
    Moderator
    Post count: 6480

    You can put those codes in your theme function.php file.

    Thanks.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Drop down to set post formats –please confirm this code’ is closed to new replies.