Viewing 15 replies - 1 through 15 (of 19 total)
  • This was my quick solution to get it to work the way I needed it to (posting to 1 category, within a page, no popup). I haven’t checked it for compatibility with anything else.
    shortcode used — [post-from-site cat=’4′]

    post-from-site.class.php
    This is line 396
    $out .= apply_filters( 'pfs_before_submit', '', $idtext );
    After that line, I added the following
    $out .= "<input type='hidden' name='cat' value='" .$cat. "' />\n";

    pfs-submit.php
    This is line 25
    $title = $pfs_data['title'];
    After that line, I added the following
    $category = $pfs_data['cat'];

    This is line 142
    $postarr['post_type'] = $pfs_options['post_type'];
    After that line, I added the following
    $postarr['post_category'] = array($category);

    Thread Starter designserious

    (@designserious)

    Thanks for the resposne rt49 but I tried what you posted with no success unfortunately. I am not sure how to get this working.

    Thread Starter designserious

    (@designserious)

    I don’t really need to do it by shortcode either. I can just hardcode the actual category number if I knew where to do it so it worked. I have tried every place I can think of to hardcode it in there with no luck.

    Try this….

    pfs-submit.php
    This is line 142-ish
    $postarr['post_type'] = $pfs_options['post_type'];
    After that line, add the following
    $postarr['post_category'] = array('4');

    4 being your category id

    Thread Starter designserious

    (@designserious)

    That worked! Thank you so much for your help, I really appreciate it.

    Great. Happy to hear it & you’re welcome.

    Hi! Can you help me? I want to specify a category that comes from a variable, so that the published post is assigned only to that specific category.

    I get the category in the template I’m calling the form vΓ­a php (not shortcode).

    I manage to get the category I want getting it from the slug like this:

    $idObj = get_category_by_slug($cat_slug);
    $id = $idObj->term_id;

    Then I tried:

    $postarr['post_category'] = array($id);

    But the variable does not seems to get there in the form πŸ™

    Can it be achieved sending a parameter here?:

    $pfs = new PostFromSite(0,'',false); $pfs->form();

    Thanks a lot!!!

    Oh, I just read from http://me.redradar.net/2012/01/10/post-from-site-3-0/ that “Known Issue: Specifying category to post to is not working” :S ???

    But you seem to solved it… or were you using an old version?

    I solved it because it was irritating and I needed for it to work, so I could be lazy and not have to mark categories after people posted. =D

    Did you try the other 2 methods that I posted?

    Hi, rt49andellis, thanks a lot for your help. As far as I understand your first method uses the shortcode and I think I cannot use it like that from within a PHP file, is that right? That is why I opted for inserting it vΓ­a php tag.

    The other one is the one I tried:

    $postarr['post_category'] = array($id);

    But I don’t know why the variable $id does not gets inside that part, it outputs as “null” πŸ™

    I’m putting the form from within a php template file, and through that same file I get the category id I need…

    Maybe you can help me achiee this, I’m so glad you can give me a hand, thanks a lot!

    Oh I just solved it! πŸ˜€

    I passed it like this:

    $pfs = new PostFromSite(0,'',false, $cat); $pfs->form();

    Thanks for your help and without your previous posts I could have never reached the solution πŸ™‚

    Nice job. =D

    Hi, I used rt’s technique to get it to post to a specific category, and it works, but on the form itself there is still a field for people to select what category they want to post to. How do I get rid of that?

    I believe you just need to change the plugin settings.

    Post From Site >> Allowed Taxonomies >> Untick Categories

    Hi rt, Excellent news that you’ve managed to get the category on the short code to work, my site was crying out for this facility.

    I’ve followed your instructions:

    post-from-site.class.php
    This is line 396
    $out .= apply_filters( ‘pfs_before_submit’, ”, $idtext );
    After that line, I added the following
    $out .= “<input type=’hidden’ name=’cat’ value='” .$cat. “‘ />\n”;

    pfs-submit.php
    This is line 25
    $title = $pfs_data[‘title’];
    After that line, I added the following
    $category = $pfs_data[‘cat’];

    This is line 142
    $postarr[‘post_type’] = $pfs_options[‘post_type’];
    After that line, I added the following
    $postarr[‘post_category’] = array($category);

    Used shortcode [post-from-site cat=’4′]

    and i’m not getting the category to assign.

    I need this to work on the shortcode as I have numberious areas that require Posts to relate to different categories but I don’t want the category dropdown on teh form.

    I’m using WordPress 3.3.1 and Post from Site 3.0.1

    Any assistance would be greatfully received or a full code for post-from-site.class.php and pfs-submit.php as i’m not sure why it’s not working.

    Mike

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘[Plugin: Post From Site] Post to a specific category working?’ is closed to new replies.