WordPress.org

Support

Support » Plugins and Hacks » Guest Posts » [Resolved] Category select

[Resolved] Category select

  • Hi,

    When somebody send me a post, the post automatically take to the original wordpress appointed post category. I want that, the guest’s post AUTOMATICALLY take a different category basically. When and how I can to set this in guest-posts-submit.php?? Sorry, but I’m an amateur. :o)))

    Thank you!

    http://wordpress.org/extend/plugins/guest-posts/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Babar

    @ibabar

    You can try to edit the submit file.

    There’s a array with those informations.

    Hi,

    yes, I can edit, but don’t know the correct strings. Please write mee!! (I know the required category’s slug, and ID, but don’t know, how must insert to the code)

    Thank you for the quick answer!

    Plugin Author Babar

    @ibabar

    I’m also not clear about it, that’s why haven’t documented about that.

    ‘post_category’ => $category, // Usable for custom taxonomies too

    Only this is the all info. It’ not enough me! :o)))

    If the category ID=124, how must to insert ?

    Sorry, I’m an really amateur. .o))))

    Plugin Author Babar

    @ibabar

    I’m also not clear about it, that’s why haven’t documented about that.

    babar, for line:
    ‘post_category’ => $category, // Usable for custom taxonomies too

    your problem is that it is asking for a array not a string. so for a quick fix all you would need to do is:
    ‘post_category’ => array($category),
    and wala its fixed 🙂

    //helper cat is helping

    Rosti, So all you need to do is apply the fix i give earlier and express the category you want on the shortcode like [guest-posts category=’124′] and that should fix your problem right quick and in a hurry

    Plugin Author Babar

    @ibabar

    Thanks Nate.
    I will update the plugin ASAP. 🙂

    Hello,

    Thanks for this nice plugin but even following clearly your indication it’s not working with following call:

    [guest-posts category=’14985′ author=’5′]

    Would be happy to find the trick, thanks for your help!

    This is a part of Guest Posts Plugin for WordPress.
    */
    
    //Get the submitted form
    ob_start();
    require_once($_POST["rootpath"]);
    $title = $_POST["title"];
    $longtitle = $_POST["longtitle"];
    $story = $_POST["story"];
    $resume = $_POST["resume"];
    $image_100100 = $_POST["image_100-100"];
    $image_490270 = $_POST["image_490-270"];
    $tags = $_POST["tags"];
    $authorbio = $_POST["authorbio"];
    $auteurimage = $_POST["auteurimage"];
    $youtubelink = $_POST["youtubelink"];
    $email = $_POST["email"];
    $deezeralbum = $_POST["deezeralbum"];
    $authorid = $_POST["authorid"];
    $artiste_nc = $_POST["artiste_nc"];
    $category = $_POST["category"];
    $thankyou = $_POST["thanks"];
    $path = $_POST["rootpath"];
    $nonce=$_POST["_wpnonce"];
    
    //Load WordPress
    //require($path);
    
    //Verify the form fields
    if (! wp_verify_nonce($nonce) ) die('Security check'); 
    
       //Post Properties
        $new_post = array(
                'post_title'    => $title,
                'post_content'  => $story,
               'post_category' => $category,   // Usable for custom taxonomies too
                'tags_input'    => $tags,
                'post_status'   => 'pending',           // Choose: publish, preview, future, draft, etc.
                'post_type' => 'post',  //'post',page' or use a custom post type if you want to
                'post_author' => $author, //Author ID
        );
        //save the new post
        $pid = wp_insert_post($new_post);
    
        /* Insert Form data into Custom Fields */
        add_post_meta($pid, 'auteur_n1', $auteur_n1, true);
        add_post_meta($pid, 'author-email', $email, true);
        add_post_meta($pid, 'author-website', $site, true);
    	add_post_meta($pid, 'artiste_nc', $artiste_nc, true);
    	add_post_meta($pid, 'resume', $resume, true);
    	add_post_meta($pid, 'longtitle', $longtitle, true);
    	add_post_meta($pid, 'image_100-100', $image_100100, true);
    	add_post_meta($pid, 'image_490-270', $image_490270, true);
    	add_post_meta($pid, 'youtubelink', $youtubelink, true);
    	add_post_meta($pid, 'authorbio', $authorbio, true);
    	add_post_meta($pid, 'auteurimage', $auteurimage, true);
    	add_post_meta($pid, 'deezeralbum', $deezeralbum, true);
    
    header("Location: $thankyou");
    ?>

    Hi Ted swiss if you change the line
    ‘post_category’ => $category, // Usable for custom taxonomies too
    to
    ‘post_category’ => array($category), // Usable for custom taxonomies too

    as Nate_Nevins said then on guest-posts/guest-posts.php

    make sure the line
    ‘cat’ => ‘1’,
    to
    ‘cat’ => ”,

    after this you can use the short code [guest-posts cat=’14985′ author=’5′]

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Resolved] Category select’ is closed to new replies.
Skip to toolbar