0

I am not php developer and I need to modify a theme, concretely the area has different categories, for example: "Adopted cats" and "Adopted dogs" both are in the same page, at the moment with categories tag I can be able to filter correctly but When I navigate (I have next and previous post button) it is not filtering correctly.

I have found this code in the theme :

<div id="portfolio-full-width">
<?php
$args = array(
    'number_of_columns' => 4,
    'image_size' => 'large-thumb',
    'posts_per_page' => 50,
    'filterable' => true
);

mo_display_portfolio_content($args);
?>

and the mo_display_portfolio_content code:

function mo_display_portfolio_content($args) {
global $mo_theme;

$mo_theme->set_context('loop', 'portfolio'); // tells the thumbnail functions to prepare lightbox constructs for the image

$paged = (get_query_var('paged')) ? get_query_var('paged') : 0; // Do NOT paginate

$args['query_args'] = array('post_type' => 'portfolio', 'posts_per_page' => $args['posts_per_page'], 'filterable' => $args['filterable'], 'paged' => $paged);

mo_display_portfolio_content_grid_style($args);

$mo_theme->set_context('loop', null); //reset it

}

First question: How to modify and what is the code for this purpose??

Thank you in advance for your help.

0

I think that when you are filtering, you are using an onpage action that hides what is not on the category clicked (done with JavaScript, usually with jQuery), and when you go to another page, you are getting a new page from the server, so your filter disappear.

I think that this behaviour is ok, and to acomplish what you expect, you need to implement a search form, where you can specify the category parameter for cats and dogs.

  • Exactly @EliasNS when I am getting a new page from the server and the behavior sounds like the filter disappear, topic is I am not PHP programmer and I don´t know how to implement a "search form" for this implementation.. – inane Feb 21 '15 at 17:28
  • I have edited the post, adding the function.. can you help me?? – inane Feb 28 '15 at 12:33
  • That code seems to be the query to get the posts corresponding with the page that is being requested. Here I don't see anything that you can do with the filter. I think you can pass a taxonomy parameter to the $args['query_args']. Look to the Codex: codex.wordpress.org/Class_Reference/WP_Query#Parameters. I am not expert to PHP code but I got it done something similar on my page: eliasdj.com/sesiones-dj – EliasNS Mar 1 '15 at 12:08
  • Thank you @EliasNS but I am not php programmer and I don´t understand the code.. – inane Mar 1 '15 at 18:10
  • I'm sorry but I am not expert to give a snippet or to make precise instructions. – EliasNS Mar 1 '15 at 23:07

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.