WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Hide single category from Events List Page (20 posts)

  1. mike.keats
    Member
    Posted 9 months ago #

    Hi,

    Have a page setup to display all the events but there is just one category I want to remove from it.

    Any help would be grateful.

    Thanks

    http://wordpress.org/plugins/events-manager/

  2. angelo
    NetWebLogic Support
    Posted 9 months ago #

    try shortcode [events_list category="-X"] where x is the event categories id at Events > Event Categories (to show event category id, click Screen Options > checked ID and click Apply Button)

    http://wp-events-plugin.com/documentation/shortcodes/
    http://wp-events-plugin.com/documentation/event-search-attributes/

  3. mike.keats
    Member
    Posted 9 months ago #

    Hi,

    Is there anyway of doing this in the settings because I have the widget on the homepage which has the View all Events link activated which seems to only point to the page that is selected within the settings.

  4. angelo
    NetWebLogic Support
    Posted 9 months ago #

    using events widget, try WP Appearance > Widgets > Events widgets > Category IDs then try -X where x is the event categories id

  5. mike.keats
    Member
    Posted 9 months ago #

    Hi,
    Sorry the widget is fine on the page needed but id you look at http://www.tsc.mkconsultancy.co.uk/our-events/ the main list of events has a "Football Test" in it near the top but do not want it there. Just want to list Football items on a widget on this page as you will see.

    This events page is selected within the Events Settings so I am unable to edit the page.

  6. philipjohn
    Member
    Posted 9 months ago #

    Hiya,

    You will likely need to remove your main events page from the setting at Events > Settings > Pages > Event List/Archives

    Then, replace the contents of your events page (it should be "CONTENTS") with the shortcode Angelo suggested above.

    Thanks,
    Phil

  7. mike.keats
    Member
    Posted 9 months ago #

    Hi,

    Will give that ago, however how do I then get the widget on the homepage to link to the page that I have this shortcode on?

  8. caimin_nwl
    NetWebLogic Support
    Posted 9 months ago #

    Do you mean the LIVE:Football widget? Those are links to single events pages so will work fine.

  9. mike.keats
    Member
    Posted 9 months ago #

    Hi,

    No, on the homepage there is a link on the Events widget that goes to the page that is the page which has the list of events which is the actual page that is selected within the settings.

    So if I create a new events page and add the shortcode to it how would I then change the link on the homepage widget to point to the new page I have created?

  10. caimin_nwl
    NetWebLogic Support
    Posted 9 months ago #

    Got you.

    You can set which page the plugin uses as the Events page by going to Events > Settings > Pages > Events List/Archive > Events page.

  11. mike.keats
    Member
    Posted 9 months ago #

    Hi,

    I under stand that but I have created a new page and added the shortcode to show a specific category but if I then select that page in Events > Settings > Pages > Events List/Archive > Events page then the shortcode is stripped out the default code use used.

    I want that Events page to show a specific category id but still be able

  12. caimin_nwl
    NetWebLogic Support
    Posted 9 months ago #

    Ok, then I think might need a slightly different approach. Does the category you're filtering out need to be filtered out throughout the site?

  13. mike.keats
    Member
    Posted 9 months ago #

    It is only going to be required on the Live: Football widget on the events page and maybe another page with a shortcode but that is it

  14. caimin_nwl
    NetWebLogic Support
    Posted 9 months ago #

    In that case, the easiest way would probably be to use shortcodes a with category attribute to show that category when needed, while creating a custom version of the events-list.php template that filters out that category.

    This tutorial shows you how to create custom templates that are upgrade safe:
    http://wp-events-plugin.com/documentation/using-template-files/

    The file you need to copy / modify is events-list.php. You'll need to filter / edit the $args array to exclude the unwanted category.

    This thread should help:
    http://wordpress.org/support/topic/events-manager-search-all-instead-of-only-future

  15. mike.keats
    Member
    Posted 9 months ago #

    Just looking at this and I am not a developer so might need a quick point, I have copied the events-list.php and not sure what I need to add to the page to filter it out?

    The current page has the following in it:
    $args = apply_filters('em_content_events_args', $args);

    if( get_option('dbem_css_evlist') ) echo "<div class='css-events-list'>";

    echo EM_Events::output( $args );

    if( get_option('dbem_css_evlist') ) echo "</div>";

  16. philipjohn
    Member
    Posted 9 months ago #

    Above that, add this;

    $args = array( 'category' => -1 );

    ...replacing 1 with the ID number of the category you want to exclude.

    Thanks

  17. mike.keats
    Member
    Posted 9 months ago #

    Thanks for that! Just tested it out and hit another problem. I have a page that lists everything for the category that I have just removed from the list page.

    This page should have the id category hidden
    http://www.tsc.mkconsultancy.co.uk/our-events/

    This page should display the category that we have hidden
    http://www.tsc.mkconsultancy.co.uk/live-football/

  18. caimin_nwl
    NetWebLogic Support
    Posted 9 months ago #

    You could try replacing the line of code that Phil gave you with something like this:

    if (is_page('pageA') ){
    $args = array( 'category' => -1 );
    } else if (is_page('pageB')) {
    $args = array( 'category' => 2 );
    }

    To explain that that does in plain English:

    If this is a page called pageA, don't show category 1.
    But if it's pageB, only show category 2.

    Obviously, you'll need to edit pageA, pageB and 1 and 2 to suit what you need.

  19. mike.keats
    Member
    Posted 9 months ago #

    That by the looks of it has done the job, thanks guys much appreciated!

  20. caimin_nwl
    NetWebLogic Support
    Posted 9 months ago #

    Cool, no problem :)

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.