New Landing How can we help? Cardinal main nav missing on category pages

Viewing 12 posts - 1 through 12 (of 12 total)
  • Posted in: Cardinal
  • #242038
    pdupree
    Member
    Post count: 40

    I’ve deactivated all plugins except Swift Framework, and main navigation is still missing.

    Also footer widgets on category pages are displaying incorrect information.

    #242040
    David Martin – Support
    Moderator
    Post count: 20834

    Hi,

    I notice you are using a child theme, have you checked you are not overwriting this template file?

    Thanks.

    #242076
    pdupree
    Member
    Post count: 40

    child theme has
    comments.php
    functions.php
    single-event.php
    single-location.php
    style.css

    In functions.php I’m using this code that I previously used with Dante.

    // Show custom post types on archives
    add_action( 'pre_get_posts', 'add_my_post_types_to_query' );
    function add_my_post_types_to_query( $query ) {
    	if ( !is_admin() && is_archive() && $query->is_main_query() )
    		$query->set( 'post_type', array( 'post', 'event', 'testimonial', 'portfolio', 'team', 'galleries') );
    	return $query;
    }
    
    // Show custom post types on archives
    add_filter( 'getarchives_where' , 'pdc_getarchives_where_filter' , 10 , 2 );
    function pdc_getarchives_where_filter( $where , $r ) {
    	if ( !is_admin () )
            $args = array( 'public' => true , '_builtin' => false );
            $output = 'names'; 
    		$operator = 'and';
            $post_types = get_post_types( $args , $output , $operator );
            $post_types = array_merge( $post_types , array( 'post', 'event', 'testimonial', 'portfolio', 'team', 'galleries') );
            $post_types = "'" . implode( "' , '" , $post_types ) . "'";
            return str_replace( "post_type = 'post'" , "post_type IN ( $post_types )" , $where );
    }
    
    #242170
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Hi

    Do you get the same issue if you activate the parent theme?

    – Kyle

    #242394
    pdupree
    Member
    Post count: 40

    Yes, same issue with parent theme

    #242554
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Can you please update the theme and let me know if that fixes the issue

    – Kyle

    #242704
    pdupree
    Member
    Post count: 40

    same result in Cardinal 2.41

    #242747
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Current version is 2.42

    – Kyle

    #243164
    pdupree
    Member
    Post count: 40

    I get the same results with Cardinal 2.42.


    FYI for the file taxonomy-portfolio-category.php, the sf_base_layout for portfolio-category is missing.

    #243698
    David Martin – Support
    Moderator
    Post count: 20834

    @pdupree – I am testing this on my dev version 2.4.2 and the Portfolio => Category pages load the menu fine for me.

    – Can you test with all plugins deactivated, leaving only the Swift Framework active. + Please leave your child theme deactive whilst we test.

    Thanks.

    #244661
    pdupree
    Member
    Post count: 40

    Here is how I solved this.
    In /swift-framework/core/sf-formatting.php

    Replaced

    /* ADD CPT TAG RESULTS TO ARCHIVES
    	================================================== */
    	function sf_add_cpt_tags_to_archive($query) {
    	    if ( is_category() || is_tag() ) {
    	        $post_type = get_query_var('post_type');
    	        if ( $post_type ) {
    	            $post_type = $post_type;
    	        } else {
    	            $post_type = array('nav_menu_item', 'post', 'portfolio', 'team', 'clients', 'testimonials', 'faqs', 'directory', 'galleries');
    	       	}
    	       	$query->set('post_type', $post_type);
    	        return $query;
    	    }
    	}
    	add_filter('pre_get_posts', 'sf_add_cpt_tags_to_archive');

    with this code I was using in Dante

    // Show custom post types on archives
    add_action( 'pre_get_posts', 'add_my_post_types_to_query' );
    function add_my_post_types_to_query( $query ) {
    	if ( !is_admin() && is_archive() && $query->is_main_query() )
    		$query->set( 'post_type', array( 'post', 'event', 'testimonial', 'portfolio', 'team', 'galleries') );
    	return $query;
    }
    
    // Show custom post types on archives
    add_filter( 'getarchives_where' , 'pdc_getarchives_where_filter' , 10 , 2 );
    function pdc_getarchives_where_filter( $where , $r ) {
    	if ( !is_admin () )
            $args = array( 'public' => true , '_builtin' => false );
            $output = 'names'; 
    		$operator = 'and';
            $post_types = get_post_types( $args , $output , $operator );
            $post_types = array_merge( $post_types , array( 'post', 'event', 'testimonial', 'portfolio', 'team', 'galleries') );
            $post_types = "'" . implode( "' , '" , $post_types ) . "'";
            return str_replace( "post_type = 'post'" , "post_type IN ( $post_types )" , $where );
    }
    
    #244707
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Great! Thanks for sharing

    – Kyle

Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register