Add additional post types to a feature post segment

Hello Jose and team. I am using https://wordpress.org/themes/mesocolumn/ theme and I want to include additional post types (specifically posts from event plugin), into the featured posts area. As per Jose I’ve included ‘post_type=”incsub_event”‘ in the filter. So now I have:

$custom_query2 = apply_filters(‘meso_featcat_query_two’, ‘post_type=”incsub_event”‘, ‘cat=’. $featcat2 . ‘&’ . ‘offset=’ . ‘&’ . ‘showposts=’ . $featcat2_count);

Ok, cool. Pulls in the events posts but then there is issue of making them relate to the template so that the drop down option sees the new post types as well, and adds them into template functions. (So new posts not just display but get handled as do the original post type ‘category’:wink:.

I assume this requires modifying additional filters in other files. Anybody know which ones? I see a few that might need modification to achieve this. The whole concept of a filter sort of leads me to believe the theme is designed for doing just this type of thing.

thanks!

  • Michelle Shull
    • DEV MAN’s Apprentice

    Hi, Joe!

    That’s a nice looking theme! It’s not one I’ve used before, so I’m not super familiar with it, but since it’s on the WP repository, we know it’s coded well. Filters are more of a WordPress concept than a theme concept, but that’s not a critical difference to you at this point.

    By drop down, do you mean the navigation bar with categories above the posts in the demo on the page you linked? That’s a secondary nav tool, and you’ll probably see it called in your header.php file if it appears on each page. If it’s only only on the front page, it will likely be called in index.php, or whatever your theme calls the main page file. (I’ve seen it as main.php and home.php) The filters may be defined here, they may be defined in a secondary nav .php file, or they might be defined in functions.php, but they will be called in one of those two files I mentioned.

    The definition is what you want. It will work just like the code Jose helped you with, you’ll just need to add a filter for events along with standard posts.

    For further reading:

    https://codex.wordpress.org/Function_Reference/add_filter

    http://doc.presscustomizr.com/customizr/wordpress-actions-filters-and-hooks-a-guide-for-non-developers/

    http://code.tutsplus.com/tutorials/50-filters-of-wordpress-an-introduction-to-filters–cms-21294

    Filters are great tools, and once you grasp their power, what you can do with WordPress will expand exponentially. There’s a bit of a learning curve, especially if you’re not used to coding/programming concepts, but it’s not as steep as it looks from the outside, once you dig in.

    Hope this helps!

  • Joe
    • Flash Drive

    Michelle,

    I have a number of related things here so the above resources are great for me thanks! Regarding the dropdown I referred to, I meant it was inside my dashboard. In the theme options you can pick a category to display as a feature. I wanted to to Events to this option and it seems adding ‘post_type=”incsub_event”‘ kinda does this but without control over the events post. I assume it’s because I am not continuing adding this new filter in the other files that control the post count, etc..

    Additionally, I am running into a problem where my events rss is not dumping the event date into the event post (not making it’s way to the date field). So any event post that is created from my rss feed won’t display. (events only display as summary on /events/ page.

    I feel like I’m in limbo land between php and shortcodes and trying to feel out what to use and where.

  • Sajid
    • DEV MAN’s Sidekick

    Hi Joe,

    Hope you are doing good today :slight_smile:

    Let us solve your issue one by one. For dropped down category inside your dashboard theme options page. Can you grant support access so we can see the fields. You can grant support access by following the steps mentioned in this manual.

    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Also please share the screenshot of dashboard page marking the specific area that you want to customize.

    Cheers, Sajid

  • Michelle Shull
    • DEV MAN’s Apprentice

    Hey, Joe!

    Okay, I did some digging, and I think I found the solution right from the developer.

    new version had filter on the featured category query. just choose any category and saved the theme option and add this to your custom functions.php or wp-content/meso-custom-functions.php

    let’s say you want a custom post type for first feat block.

    function meso_custom_featname() {
    $query = 'My Event';
    return $query;
    }
    add_filter('meso_featcat_name_one','meso_custom_featname');

    function meso_custom_featlink() {
    $query = 'http://yoursite.com/events/';
    return $query;
    }
    add_filter('meso_featcat_link_one','meso_custom_featlink');

    function meso_custom_featquery() {
    $query = 'post_type=eab_events&showposts=5';
    return $query;
    }
    add_filter('meso_featcat_query_one','meso_custom_featquery');

    https://wordpress.org/support/topic/some-post-type-not-appearing-on-front-page#post-6589286

    I changed the specific references to that users custom post type to those for Events+, but you’ll need to add your URL in the seventh line from the top.

    You won’t need Jose’s code with this, as best I understand it, so comment out those lines he gave you before you add these as the theme developer described.

    He’s super active in his support forum, I’m super impressed with him and his theme.

    Hope this helps!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.