Title Problem (2 posts)

  1. usmanmohammadi
    Posted 1 year ago #

    I've recently start a blog about wordpress but I got a problem on it that my main page show the title of recent post but I set another title by yoast plugin but still shows the recent post title on homepage,

    How I can change it.

    Further, I want to disable featured image from just post not from main page. How I can do it.

    Thanks in advance...

  2. bcworkz
    Posted 1 year ago #

    These changes require alterations to your theme templates. To avoid losing your changes when the theme is updated, you should create a child theme in which to contain your changed templates.

    It's difficult for plugins to fully anticipate how any particular theme might do things, so it is not a big surprise your Yoast setting does not make it through your theme. I'm not familiar with the inner workings of Yoast, but that title setting is stored somewhere. You need to determine that to know how to retrieve the data. You will probably use something like get_option() or get_user_meta().

    Then locate on your theme template where the latest post title is output. Change the template to output the title set in Yoast that is retrieved using the appropriate function.

    Templates typically show featured images with code similar to this:

    if ( has_post_thumbnail( $post->ID ) )
       echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );

    Simply remove this portion from templates where you do not want featured images displayed. There is often an "else" clause to display a default image when there is no featured image. You may want to retain this portion, but without the "else" bit, since you removed the corresponding "if()".

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.