Support Forums

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Displaying taxonomies from filter results on metatags not working

Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Cesar Romero
    #234721

    Hi Trevor,

    I’m coming back to this issue because now I’m trying to add the taxonomy on the metatags using this piece of code that you shared me.

    It works good on <body>

    <h1 class="hcourses"><a href="https://example.com/course/"><?php echo substr($sf_current_query->get_field_string("_sft_activitiesCourse"), 10); ?> courses</a></h1>

    But it doesn’t work when I put it inside the <head> of the page.

    <meta name="description" content="Worldwide <?php echo substr($sf_current_query->get_field_string("_sft_activitiesCourse"), 10); ?> courses"/>

    Any suggestions?

    Appreciate your time

    Trevor Moderator
    #234724

    I assume the $sf_current_query is defined before that line?

    Cesar Romero
    #234727

    Nope…

    I mean I used on body and works fine.

    How should I defined on the head?

    Thanks for your time Trevor

    Cesar Romero
    #234731

    Like this?

        <?php
        //grab the active query from our search form
    	//replace <code>1526</code> with the ID of your search form
    	global $searchandfilter;
    	$sf_current_query = $searchandfilter->get(3969)->current_query();
    	?>  
    Trevor Moderator
    #234735

    It might be, that so early in making the page, our form is not yet initialized, so that there is no current query at that point?

    Cesar Romero
    #234742

    Yes.

    It seems to work.

    Thanks for your time Trevor!

    Trevor Moderator
    #234751

    Thanks for letting me know. I will close this thread for now.

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

The topic ‘Displaying taxonomies from filter results on metatags not working’ is closed to new replies.