1

Hello guys how are you? i am not that good at developing websites and i need to have more experience. can you guys help me? i had an idea on the screenshot i have on the link below. as you can see i want the circled one to be a category and the other non circled are all the products you have. i tried everything from plugins to editing a custom product archive but it really wont budge. i just want to know if my idea is applicable, doable or not.

Thank you guys always for helping people on codes. You guys are the best.

Thank you in advance. :)

http://i.stack.imgur.com/d1L6E.png

0

First of all, yes, and there are many ways to achieve this. The first thing you will want to do is create a child theme or plugin. One of those two is where you will be adding your code...

This can be done by using wp action pre_get_posts there is a great post that Remi Corson has here to explain more about modifying if only on the archive page:

from on of his examples (with a little mod):

// Load our function when hook is set
add_action( 'pre_get_posts', 'rc_modify_query_get_design_projects' );
function rc_modify_query_get_design_projects( $query ) {

    // Check if on frontend and main query is modified
    if( ! is_admin() && $query->is_main_query() && is_post_type_archive( 'product' ) ) {

        $query->set( 'cat', '20' ); // whatever your category id is here

    }

}

something like the above (very much untested in your environment), but I think you can get the idea here...

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.