1

How can I filter my custom post type like it's filtered by WordPress itself? By that I mean the links that allow you to show only published, private or trashed posts.

I need it because I want to filter my event post type in a way that you'll only see upcoming events at first, being still able to see all events.

I came across this question but it would be a dropdown instead of these links.

filters

[edit]

So what I want is to have a link Past events next to the Published link instead of using the standard dropdown menus.

[edit2]

I eventually did use a dropdown, based on this answer: https://wordpress.stackexchange.com/a/45447/28916

0

I would suggest using post_submitbox_misc_actions action as shown in the below example to provide an option for Publish meta-box.

<?php

add_action( 'post_submitbox_misc_actions', 'my_post_submitbox_misc_actions' );

    function my_post_submitbox_misc_actions(){
    ?>
    <div class="misc-pub-section my-options">
        <label for="my_custom_post_action">My Option</label><br />
        <select id="my_custom_post_action" name="my_custom_post_action">
            <option value="1">First Option goes here</option>
            <option value="2">Second Option goes here</option>
        </select>
    </div>
    <?php
    }

    ?>

Once used for at-least one post( or a CPT), then those options should appear beside publish actions in all posts admin page.

  • If I would go with this approach, I would have to set the event to past manually, right? Can I do the same in a way that's automated, based on the date in the meta data of my post? – Scuba Kay Feb 2 '14 at 13:39
  • I think this method may not work for what you are asking now. – sri Feb 3 '14 at 8:34
  • If you have no other way, i would suggest using java-script. I am pretty sure you can achieve this. – sri Feb 3 '14 at 8:46
  • Wow, that never even crossed my mind. – Scuba Kay Feb 3 '14 at 8:50
  • :) Then go ahead... I could give a hand if you need at some point. – sri Feb 3 '14 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.