• Resolved elainebosse

    (@elainebosse)


    Hello, I have a problem on a client’s WP site, the custom title I’m saving for the front page doesn’t load in the theme, but the Description is working fine.

    My front page is a static page set through WP settings with simple content in it.

    I’m using a “blankslate” theme of shorts, but we don’t have a function for the wp_title to overwrite anything.

    I’m trying to get rid of the “Home” title – currently the field contains: “Enduride – Performance Rollers & Idlers”

    Any help would be appreciate!

    https://enduridecanadausa.com/

    https://www.ads-software.com/extend/plugins/add-meta-tags/

Viewing 15 replies - 1 through 15 (of 50 total)
  • Plugin Author George Notaras

    (@gnotaras)

    This will be fixed in the upcoming version. Thanks for your feedback.

    Plugin Author George Notaras

    (@gnotaras)

    Originally the custom title feature was not meant to be used on a static page which is used as the front/posts page.

    I tried to make it work, but it seems there is a limitation of the usage of the default WordPress is_front() function when used inside a ‘wp_title’ filter. This function is essential for the check, so, I’ll have to find a workaround using the page IDs instead.

    I’ll postpone the resolution for another future release.

    However, the normal title of a static page that is used as the frontpage does not usually appear anywhere inside the content, so I guess the custom title for such a page is a bit of overkill.

    Plugin Author George Notaras

    (@gnotaras)

    It seems to work as expected for the front page that is a static page, after doing the filter priority change I wrote about in: https://www.ads-software.com/support/topic/custom-title-issue

    bodokade

    (@bodokade)

    Hallo George,

    I’ve a smiliar problem: I’m using the latest version of your plugin. The website uses a theme template front-page.php and therefore does not have an active post in $post. This has the effect that your plugin refuses to handle that call allthough is_home() returns true.

    Your code in amt_get_metadata_head() is:

    $post_type = get_post_type( $post );
    if ( ! in_array( $post_type, amt_get_supported_post_types() ) ) {
    $do_add_metadata = false;
    }

    As $post ist empty, the $post_type results to false and your plugin does not generate the header-code.

    You might want to change that in future version. E.g. using

    if ( !is_home() && !in_array( $post_type, amt_get_supported_post_types() ) ) {
    $do_add_metadata = false;
    }

    seems to work fine.

    Plugin Author George Notaras

    (@gnotaras)

    Hi.

    is_home() returns true at the following cases:

    1) If the latest posts are displayed on the front page (default behavior of WP) and the user visits the front page

    2) If a static page is used as the “latest posts page” and the user visits this page (not front page).

    The case we are dealing with is #1, right? Because in #2 the $post object (retrieved using get_queried_object()) is never null. I’m asking this because front-page.php got me confused.

    Apart from this, there is a problem I noticed.

    As $post ist empty, the $post_type results to false and your plugin does not generate the header-code.

    I’m testing this in WP 3.7.1. Even if the $post object might be null (case #1), get_post_type($post) still returns post instead of false!

    I am not sure if this is a WordPress bug or a feature, but it’s definitely the cause of the well hidden bug we are dealing with in this topic.

    Plugin Author George Notaras

    (@gnotaras)

    @bodokade: Your feedback let me better understand what the problem is. Thanks a lot.

    bodokade

    (@bodokade)

    Hallo George!

    I’ve taken a closer look. I thought your $post is the global $post. I did a var_dump( $post ) in front-page.php and this showed a filled objekt.

    But your functions are using get_queried_object() which returns in my case empty.

    btw: i would like to configure which of your meta-fields should by visible when editing an entry. E.g. “Full meta tags:” is hardly of use to me for a simple article but needs a lot space on the screen.

    Kind regards

    Plugin Author George Notaras

    (@gnotaras)

    But your functions are using get_queried_object() which returns in my case empty.

    Thanks for confirming it. Much appreciated.

    btw: i would like to configure which of your meta-fields should by visible when editing an entry. E.g. “Full meta tags:” is hardly of use to me for a simple article but needs a lot space on the screen.

    I understand. I’ll file it as a feature request. But it is very unlikely to be implemented by adding options in the admin panel. I try to keep the admin panel as simple as possible. I think it will be configurable through the use of a filter. A function that configures it could then be placed in the functions.php file of the theme.

    Plugin Author George Notaras

    (@gnotaras)

    I’ve taken a closer look. I thought your $post is the global $post. I did a var_dump( $post ) in front-page.php and this showed a filled objekt.

    This must be the last of the posts that were loaded by the loop.

    BTW, a release of the plugin with the fix will most probably be out during the weekend or next week, unless I find enough time to do it earlier. The release will have many other enhancements on which I’ve been working lately.

    Kind Regards,
    George

    bodokade

    (@bodokade)

    is_home() returns true at the following cases:

    1) If the latest posts are displayed on the front page (default behavior of WP) and the user visits the front page

    2) If a static page is used as the “latest posts page” and the user visits this page (not front page).

    The case we are dealing with is #1, right? Because in #2 the $post object (retrieved using get_queried_object()) is never null. I’m asking this because front-page.php got me confused.

    I’ve never thought about this in details but I checked it now:

    version 1) uses front-page.php; is_home() returns true; get_queried_object() returns null

    version 2) uses front-page.php; is_home() returns false; get_queried_object() returns an object.

    In my opinion is_home() should return true in both cases. What you say about get_queried_object() looks correct.

    Thanks for the fixing. I’ll give it a try next week.

    Plugin Author George Notaras

    (@gnotaras)

    Because of the way it works, its name does not make sense.

    Plugin Author George Notaras

    (@gnotaras)

    Hi bodokade,

    I’m looking at this right now and I need some more information about the initial problem so I can reproduce it.

    Basically I need the following:

    1. The problem appeared on a) the default front page (regular WP latest posts page), b) a static front page, c) a static posts page ?

    2. The problem was that metadata was a) not generated or b) it was generated but there was a PHP warning?

    I have the impression that, despite the hidden bug, the plugin should have worked correctly. When 1a is the case, the metadata generators do not use $post at all. In cases 1b and 1c, they use $post, but in these cases there is always a $post object to use.

    Please shed some light on this. Thank you in advance.

    bodokade

    (@bodokade)

    Hello!

    I can see it in german only. The selected radio button’s html ist:

    <input name=”show_on_front” type=”radio” value=”posts” class=”tog” checked=”checked”/>

    I think thats ‘latest posts page”

    There are no warnings or notices (I switched them ON) but just an empty-line-output. ALL functions of amt-template-tags.php have an empty-line-output.

    In my header.php there is:

    =============================
    <meta name=”viewport” content=”initial-scale=1.0,width=device-width,maximum-scale=1.0″>
    <?php
    amt_content_description();
    amt_content_keywords();
    amt_metadata_head();
    amt_metadata_footer();
    ##amt_metadata_review(); // error: Call to undefined function amt_get_metadata_inspect()
    ?>
    <title>123</title>
    =============================

    the generated html-code is:

    =============================
    <meta name=”viewport” content=”initial-scale=1.0,width=device-width,maximum-scale=1.0″>

    <title>123</title>
    =============================

    According to $post: The plugin does not use $post. It only uses get_queried_object(). There is no “global $post” and get_queried_object() also does not return the global $post.

    Plugin Author George Notaras

    (@gnotaras)

    Apart from the fact that get_post_type($post) returns post instead of false, if $post is null, which made me improve the checks, I do not see any problematic behavior either with the generated metadata or the custom title.

    I’ll recheck the plugin more thoroughly after you provide some more feedback about the problem.

    Thank you

    Plugin Author George Notaras

    (@gnotaras)

    Oh, you use the template tags. OK. I’ll get back with more info in a while.

    Thanks for your feedback.

Viewing 15 replies - 1 through 15 (of 50 total)
  • The topic ‘Front page custom title not working’ is closed to new replies.