• Resolved Mance Creative

    (@mance-creative)


    Hi Steve,

    I currently have the directory links resolving to a different page/template for the single profiles using the “home_id” in the shortcode. However, I noticed that also changes the permalink for the Categories dropdown when selecting a category. Instead of using the directory page template when selecting a category, it uses the other page template that I set as the “home_id”.

    Is there a way to have the category selection resolve to the directory page/template while also having the “home_id” resolve to the other page template? If that makes sense…

    Thanks!
    Mitch

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Mance Creative

    (@mance-creative)

    Hi Steven,

    Actual I just found a function snippet that worked which you provided a few years ago for another website we worked on, that had the same need. ??

    Thanks!
    Mitch

    Plugin Author Steven

    (@shazahm1hotmailcom)

    Good to hear you found the solution! I do have to apologize!!! It seems to have missed your reply to the other support forum thread. It this the same issue?

    Thread Starter Mance Creative

    (@mance-creative)

    Hi Steven,

    Yes, it actually was the same issue. ?? It just hit me that you had helped us with the same issue a few years ago, so luckily I found the snippet code needed.

    Thanks again! ??
    Mitch

    Plugin Author Steven

    (@shazahm1hotmailcom)

    ok, I’ll mark both resolved.

    If I may… can you share the code snippet, so I can refresh my memory. Thanks and have a great evening.

    Thread Starter Mance Creative

    (@mance-creative)

    Hi Steven,

    Not a problem. Here is that snippet.

    Connections :: Load Template Based on Entry Type

    add_filter(
    	'cn_load_template',
    	function( $atts ) {
    
    		if ( $slug = cnQuery::getVar( 'cn-entry-slug' ) ) {
    
    			// Grab an instance of the Connections object.
    			$instance = Connections_Directory();
    
    			$result = $instance->retrieve->entry( $slug );
    
    			if ( false !== $result ) {
    				$atts['list_type'] = $result->entry_type;
    			}
    		}
    
    		return $atts;
    	}
    );

    This basically allowed the Directory to use a different page template than the profile page template without having to use “home_id” for the shortcode on the Directory page. The profile page template is then able to utilize the “Individual” template type we chose in the template settings, without having to use the “home_id” for the Directory shortcode. So as a result we can use the category, keyword search, alpha filter, etc., on the Directory page and have that resolve using the Directory page template, instead of the “home_id” template of the profile page as it was trying to do previously. If that makes sense. ??

    Thanks!
    Mitch

    Plugin Author Steven

    (@shazahm1hotmailcom)

    Ok, I remember writing this now. Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to get Category selection to resolve to Directory Page Template?’ is closed to new replies.