Before you ask please READ THIS

Single Category BLOG

edited January 2015 in Fame Posts: 6
Dear All
I need two different pages for blog on a single site with fame template. (like mysite.com/blog/cat & mysite.com/blog/dog)

I try to realize this using a standard page using Post Grid in visual composer, but this seems not supporting pagination, so it's not usabel for large archive database.

I try to use the standard blog function but i have the problem to configure permalink to work for page blog to show two different categories (once at time) and the page title.

Any suggestion is welcome.

Regards

Giancarlo

Comments

  • AirAir
    Posts: 10,970
    Hi there:-)
    zanettistudio said: I try to realize this using a standard page using Post Grid in visual composer, but this seems not supporting pagination, so it's not usabel for large archive database.
    True.
    zanettistudio said: I try to use the standard blog function but i have the problem to configure permalink to work for page blog to show two different categories (once at time) and the page title.
    What exactly is the problem?

    You should be able to link categories of your blog just in menu, and it should work on Archive pages so it should be all fine.

    With kind regards.
  • edited January 2015 Posts: 6
    Hi add a simple url rewriting function to filter category automatically depending on url

    exampel

    http://my.site.com/blog/category/title

    In functions.php
    
    //add a query vars to update title in template
    function add_query_vars($q) {
        $q[] = 'forcepagetitle';
        return $q;
    }
    add_filter('query_vars', 'add_query_vars');
    
    //Filtre category using url
    function add_author_rules() { 
    	
        add_rewrite_rule(
            'blog/(.*)/(.*)',
            'index.php?category_name=$matches[2]&forcepagetitle=$matches[1]',
            "top");
    	
    	global $wp_rewrite;
    	$wp_rewrite->flush_rules(true);
    		
    }
    add_action( 'init', 'add_author_rules' );
    

    in index.php
    change line 19
    
    <?php a13_title_bar($wp->query_vars['forcepagetitle']); ?>
    
    Post edited by Air on
  • AirAir
    Posts: 10,970
    In understand that this is solution to your question, right?:-)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!