Forums

Press This and setting a Default Category (4 posts)

  1. steve.mcnally
    Member
    Posted 1 year ago #

    Hello -

    I'd like to pass a Category automatically when I use "Press This."

    I've created a copy of press-this.php and worked to change this line to include a static category

    From:


    $quick['post_category'] = $_REQUEST['post_category'];

    To:


    $quick['post_category'] = 'myStaticCategory';

    The post is being created, but the Category is not auto-set.

    Is there anything else I need to be aware of as I continue working on this?

    Many thanks for your time, and please let me know if I can clarify any of this.

  2. ywftdg
    Member
    Posted 8 months ago #

    I would love to know this also. In your case, I think you need to define the cat by the number, not actual name. But either way, I am trying same thing sort of, and it wont set it. I can define it, but for some reason it does not save it when I click publish. You ever get it working?

  3. ywftdg
    Member
    Posted 8 months ago #

    Well, wasn't able to do how I was thinking, but if you set that _REQUEST back to the default, then add this in your design somewhere it will let you choose a cat.

    <div id="categorydiv" class="stuffbox">
    <h3><?php _e('Categories') ?></h3>
    <div class="inside">
    <div id="categories-all">
    <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
    <?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>
    </ul>
    </div>
    </div>
    </div>
  4. johnke
    Member
    Posted 7 months ago #

    This is a horrible, kludgy solution to this. It will break the next time you upgrade Wordpress, but hopefully, there will be a feature to choose default categories for "press this" soon.

    Edit wp-admin/press-this.php

    <div id="categorydiv" class="stuffbox">
      <h2><?php _e('Categories') ?></h2>
      <div class="inside">
        <div id="categories-all" class="ui-tabs-panel">
          <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
            <!-- Edit this line to suit your setup - my default category number is "11" and its name is "random" -->
            <li id='category-11'><label class="selectit"><input value="11" type="checkbox" checked name="post_category[]" id="in-category-11"/>random</label></li>
            <?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>
          </ul>
        </div>

Topic Closed

This topic has been closed to new replies.

About this Topic