Looking for a way to merge Event Category with Blog Category

Home Forums Calendar Products Events Calendar PRO Looking for a way to merge Event Category with Blog Category

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #14125
    Jason
    Participant

    I need to figure out a way so that within a certain Blog Category all Events in a certain category are intermixed with the Blog Posts. Any idea how this can be accomplished?

    #14136
    Jonah
    Participant

    Hey Jason, you’ll need to adjust your category query to include events in a specific event category. Try opening up your theme’s category.php file and adding the following code before the if(have_posts()) bit:


    'tribe_events',
    'tax_query'=>array(
    array(
    'taxonomy' => 'tribe_events_cat',
    'field' => 'id',
    'terms' => 4,
    'operator' => 'IN'
    )
    )
    ));
    ?>

    Where ‘terms’ contains the ID of the events category you’d like to include. Let me know whether or not that helps.

    #14138
    Jonah
    Participant

    Ooops, code got messed up, try this instead:


    query_posts(array(
    'eventDisplay'=>'month',
    'post_type'=>'tribe_events',
    'tax_query'=>array(
    array(
    'taxonomy' => 'tribe_events_cat',
    'field' => 'id',
    'terms' => 4,
    'operator' => 'NOT IN'
    )
    )
    ));

    Make sure to wrap it in opening/closing php tags.

    #14146
    Jason
    Participant

    Thanks Jonah, I won’t have a chance to delve into this and test it for a while, getting ready to go on vacation. But I appreciate you taking the time to offer some guidance.

    I’m not a PHP programmer, but can typically hack, cut, copy, and paste my way around. 🙂 Wouldn’t there need to be something that specifies which Blog Category that I want the specific Event Category to be merged with?

    I’m not sure if this will help provide more specific instructions, but I’m looking to Merge Event Category ID 8 with Blog Category ID 8. I’m not sure if its just coincidence that they have the ID #, or if that maybe has something to do with the fact that both Categories have the same name?

    Also is there possibly a way to do this in the functions.php perhaps so I don’t have to modify any theme files.

    #14166
    Jonah
    Participant

    Hey Jason,

    What you’ll probably want to do is create a specific blog category template and in that throw in the code above to add in the specific events you want. Here’s information on creating specific category templates in WordPress: http://codex.wordpress.org/Category_Templates

    Good luck!

    #14167
    Jason
    Participant

    Thanks Jonah, blog category templates were not something I was aware of, but that looks like the right track for sure, and glad to learn about them.

    From your snippet above, am I safe to assume that I need to change the “terms” value to 8, the Event Category ID that I want to merge with custom category template I need to create for Blog Category ID 8.

    Thanks for your assistance, you guys are doing a great job supporting your plugin, money well spent!

    #14195
    Jonah
    Participant

    Hey Jason,

    Yeah, you would want to put ‘8’ in for terms because event categories are actually taxonomies and the code above is executing an extra tax_query (taxonomy query) to check for that taxonomy ID.

    Hope that works! If you feel up to it we’d really appreciate any shout outs on Twitter, Facebook or your blog if you have one!

    Cheers,
    Jonah

    #15263
    Jason
    Participant

    Hi Jonah, Sorry to bring back this old thread but I’m finally getting around to attempting to get this working. In this project I’m using the Genesis Framework, which doesn’t have a category.php file.

    I think what I’m needing to do here is create a category template that uses a custom loop.

    I’m thinking the following tutorial is somewhat relevant to what I’m trying to do.
    http://highfxmedia.com/blog/studiopress-genesis-custom-page-templates-part-2/

    Unfortunately, I just don’t know how to write the loop that will combine the Category ID that I want with the Event Category ID that I want, as the PHP programming is outside my current skill level.

    With this additional information of my infrastructure is there any additional guidance you can provide.

    #15270
    Jonah
    Participant

    Hi Jason,

    If you don’t know PHP very well this is going to be difficult and we’re not going to really be able to help you out much. This might help though, I found this googling around for ‘genesis modify standard loop’ (Source: http://designsbynickthegeek.com/tutorials/genesis-explained-framework-actions):


    remove_action('genesis_loop', 'genesis_do_loop');
    add_action('genesis_loop', 'child_do_loop');
    function child_do_loop() {
    global $query_string;

    $args = array ( 'cat' => -1, 'order' => 'ASC' );

    $args = wp_parse_args( $query_string, $args );

    genesis_custom_loop( $args );
    }

    You can try placing that in your functions.php file and then you’ll want to modify the arguments being passed to the query to include the ‘tribe_events’ post type and the tax_query args for your category… Something along these lines:


    remove_action('genesis_loop', 'genesis_do_loop');
    add_action('genesis_loop', 'child_do_loop');
    function child_do_loop() {
    global $query_string;

    $args = array ( 'post_type' => array('post','tribe_events'), 'tax_query' => array(... use the above tax_query code ...) );

    $args = wp_parse_args( $query_string, $args );

    genesis_custom_loop( $args );
    }

    You’ll probably also only want to execute this on certain pages otherwise this is going to affect the standard loop wherever it’s called (i.e. archives, search and category pages)

    I hope that helps, good luck!
    Jonah

    #15274
    Jason
    Participant

    Thanks for the additional assistance Jonah, I’m going to take the info you have provided and see if someone on the Genesis forum can give me some additional help, if that doesn’t work out I’ll hire someone to help with this feature. Thanks again for taking the time.

    #15276
    Jonah
    Participant

    No problem Jason, hopefully that steered you in the right direction.

    #975633
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Looking for a way to merge Event Category with Blog Category’ is closed to new replies.