Forum Replies Created

Viewing 3 replies - 16 through 18 (of 18 total)
  • 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.

    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

    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.

Viewing 3 replies - 16 through 18 (of 18 total)