Listing Page H1

This topic contains 10 replies, has 3 voices, and was last updated by  VT 7 years, 6 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #303751

    VT
    Full Member
    Post count: 65

    Good afternoon!

    We are seeing odd behavior where the H1 tag for listing pages is showing the title of the first post.

    see: https://www.vegantravel.com/activities/

    We would like the H1 here to say Vegan Activities, but it is showing the name of the first listing.

    also see:
    https://www.vegantravel.com/events/
    https://www.vegantravel.com/accommodations/

    It also looks like it is happening with location “archive” pages:
    https://www.vegantravel.com/dining/mexico/distrito-federal/ciudad-de-mexico/
    https://www.vegantravel.com/dining/mexico/distrito-federal/
    https://www.vegantravel.com/dining/mexico/

    any ideas?

    Thanks!

    #303755

    VT
    Full Member
    Post count: 65
    This reply has been marked as private.
    #304262

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    did you try deactivating all non GD plugins to see if one is overwriting the archive titles?

    I would also try to update the theme and all plugins.

    Let us know,

    Thanks

    #304471

    VT
    Full Member
    Post count: 65

    Sorry, I had updated everything on our development site and still saw the issues. I had not gotten around to updating the main site yet, so we could complete the testing on the dev site.

    Anyway, Everything is updated now and I did turn off all other plugins on the dev site and still saw the issue.

    #304473

    VT
    Full Member
    Post count: 65
    This reply has been marked as private.
    #304490

    Paolo
    Site Admin
    Post count: 31206

    The developers will let us know asap, they have been alerted.

    Thanks

    #304756

    Giri
    Expired Member
    Post count: 3155

    I see all your 3rd party plugins are active. Could you disable non GD plugins till I debug this issue?

    Thanks

    #304789

    Giri
    Expired Member
    Post count: 3155

    Your first listing title is displayed in the main title. We had this problem earlier. But we fixed that one.

    Can you make sure you have updated everything including the GD templates you copied in your theme.?

    Thanks

    #305780

    VT
    Full Member
    Post count: 65

    I think found the issue within the functions.php file of our child theme. We have added the following code to change titles of category archive pages. When I remove the code, listing page titles works as expected.

    I am not sure how to modify it prevent overwriting the Geodirectory listings page titles, but I suspect it is the last else line that outputs Get_the_title() ? Maybe?

    Can you help me with the lines needed to be added? Please?

    function kleo_title()
    {
    $output = “”;
    if ( is_category() )
    {
    $output = __(”,’kleo_framework’).” “.single_cat_title(”,false);
    }
    elseif (is_day())
    {
    $output = __(‘Archive for date:’,’kleo_framework’).” “.get_the_time(‘F jS, Y’);
    }
    elseif (is_month())
    {
    $output = __(‘Archive for month:’,’kleo_framework’).” “.get_the_time(‘F, Y’);
    }
    elseif (is_year())
    {
    $output = __(‘Archive for year:’,’kleo_framework’).” “.get_the_time(‘Y’);
    }
    elseif (is_search())
    {
    global $wp_query;
    if(!empty($wp_query->found_posts))
    {
    if($wp_query->found_posts > 1)
    {
    $output = $wp_query->found_posts .” “. __(‘search results for:’,’kleo_framework’).” “.esc_attr( get_search_query() );
    }
    else
    {
    $output = $wp_query->found_posts .” “. __(‘search result for:’,’kleo_framework’).” “.esc_attr( get_search_query() );
    }
    }
    else
    {
    if(!empty($_GET[‘s’]))
    {
    $output = __(‘Search results for:’,’kleo_framework’).” “.esc_attr( get_search_query() );
    }
    else
    {
    $output = __(‘To search the site please enter a valid term’,’kleo_framework’);
    }
    }
    }
    elseif (is_author())
    {
    $curauth = (get_query_var(‘author_name’)) ? get_user_by(‘slug’, get_query_var(‘author_name’)) : get_userdata(get_query_var(‘author’));
    $output = __(‘Author Archive’,’kleo_framework’).” “;

    if(isset($curauth->nickname)) $output .= __(‘for:’,’kleo_framework’).” “.$curauth->nickname;

    }
    elseif (is_tag())
    {
    $output = __(‘Tag Archive for:’,’kleo_framework’).” “.single_tag_title(”,false);
    }
    elseif(is_tax())
    {
    $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) );
    $output = __(”,’kleo_framework’).” “.$term->name;

    } elseif ( is_front_page() && !is_home() ) {
    $output = get_the_title(get_option(‘page_on_front’));

    } elseif ( is_home() && !is_front_page() ) {
    $output = get_the_title(get_option(‘page_for_posts’));

    } elseif ( is_404() ) {
    $output = __(‘Error 404 – Page not found’,’kleo_framework’);
    }
    else {
    $output = get_the_title();
    }

    if (isset($_GET[‘paged’]) && !empty($_GET[‘paged’]))
    {
    $output .= ” (“.__(‘Page’,’kleo_framework’).” “.$_GET[‘paged’].”)”;
    }
    return $output;
    }

    #306035

    Giri
    Expired Member
    Post count: 3155

    Try this code

    
    
    function kleo_title()
    {
        $output = "";
    
        if ( is_category() )
        {
            $output = __('','kleo_framework')." ".single_cat_title('',false);
        }
        elseif (is_day())
        {
            $output = __('Archive for date:','kleo_framework')." ".get_the_time('F jS, Y');
        }
        elseif (is_month())
        {
            $output = __('Archive for month:','kleo_framework')." ".get_the_time('F, Y');
        }
        elseif (is_year())
        {
            $output = __('Archive for year:','kleo_framework')." ".get_the_time('Y');
        }
        elseif (is_search())
        {
            global $wp_query;
            if(!empty($wp_query->found_posts))
            {
                if($wp_query->found_posts > 1)
                {
                    $output =  $wp_query->found_posts ." ". __('search results for:','kleo_framework')." ".esc_attr( get_search_query() );
                }
                else
                {
                    $output =  $wp_query->found_posts ." ". __('search result for:','kleo_framework')." ".esc_attr( get_search_query() );
                }
            }
            else
            {
                if(!empty($_GET['s']))
                {
                    $output = __('Search results for:','kleo_framework')." ".esc_attr( get_search_query() );
                }
                else
                {
                    $output = __('To search the site please enter a valid term','kleo_framework');
                }
            }
    
        }
        elseif (is_author())
        {
            $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
            $output = __('Author Archive','kleo_framework')." ";
    
            if(isset($curauth->nickname)) $output .= __('for:','kleo_framework')." ".$curauth->nickname;
    
        }
        elseif (is_tag())
        {
            $output = __('Tag Archive for:','kleo_framework')." ".single_tag_title('',false);
        }
        elseif(is_tax())
        {
            $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
            $output = __('','kleo_framework')." ".$term->name;
    
        } elseif ( is_front_page() && !is_home() ) {
            $output = get_the_title(get_option('page_on_front'));
    
        } elseif ( is_home() && !is_front_page() ) {
            $output = get_the_title(get_option('page_for_posts'));
    
        } elseif ( is_404() ) {
            $output = __('Error 404 - Page not found','kleo_framework');
        }
        else {
            if (geodir_is_page('listing')) {
                ob_start(); // Start buffering;
                geodir_action_listings_title();
                $title = ob_get_contents();
                ob_end_clean();
                $output = $title;
            } elseif (geodir_is_page('author')) {
                ob_start(); // Start buffering;
                geodir_action_author_page_title();
                $title = ob_get_contents();
                ob_end_clean();
                $output = $title;
            } else {
                $output = get_the_title();
            }
        }
    
        if (isset($_GET['paged']) && !empty($_GET['paged']))
        {
            $output .= " (".__('Page','kleo_framework')." ".$_GET['paged'].")";
        }
    
        return $output;
    }
    #306267

    VT
    Full Member
    Post count: 65

    That worked! Thank you. 🙂

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

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket