• Resolved qph9697

    (@qph9697)


    Hi,

    I have an issue related to the featured image, showing on a page.

    When I add a featured image on a “page”, it is placed “above the title” and “outside the content area”.

    I want the image below the title and inside the content area.

    Can you please help me with this?

    Here is the page link, for your reference
    https://questionpapershub.com/home/example-page-demo/

    And this only happens on “pages”.

    • This topic was modified 4 years, 6 months ago by qph9697.
Viewing 11 replies - 1 through 11 (of 11 total)
  • Leo

    (@leohsiang)

    Hi there,

    Try this PHP:

    add_action( 'after_setup_theme', function() {
        remove_action( 'generate_before_content', 'generate_featured_page_header_inside_single', 10 );
        add_action( 'generate_after_entry_title', 'generate_featured_page_header_inside_single', 15 );
    } );

    The option is included in our premium plugin:
    https://docs.generatepress.com/article/adjusting-the-featured-images/

    Thread Starter qph9697

    (@qph9697)

    add_action( ‘after_setup_theme’, function() {
    remove_action( ‘generate_before_content’, ‘generate_featured_page_header_inside_single’, 10 );
    add_action( ‘generate_after_entry_title’, ‘generate_featured_page_header_inside_single’, 15 );
    } );

    Hi, the PHP didn’t work for the “Page”.

    But it did affect my “Post’s featured image”.
    Duplicate featured image was added on every “post”.

    Here is a screenshot, for your reference,
    https://ibb.co/qg20Fgn

    Theme Author Tom

    (@edge22)

    Hi there,

    Try this instead:

    add_action( 'after_setup_theme', function() {
        remove_action( 'generate_after_header', 'generate_featured_page_header', 10 );
        add_action( 'generate_after_entry_title', 'generate_featured_page_header', 15 );
    } );

    Let me know ??

    Thread Starter qph9697

    (@qph9697)

    Hi,

    add_action( ‘after_setup_theme’, function() {
    remove_action( ‘generate_after_header’, ‘generate_featured_page_header’, 10 );
    add_action( ‘generate_after_entry_title’, ‘generate_featured_page_header’, 15 );
    } );

    I tried this, and the featured image was gone as if I haven’t added any featured image on my “page”.

    But, this didn’t affect my “post”.

    Hi if this helps,

    add_action( ‘wp’, function() {
    remove_action( ‘generate_before_content’, ‘generate_featured_page_header_inside_single’, 10 );
    add_action( ‘generate_after_entry_header’,’generate_featured_page_header_inside_single’, 10 );
    } );

    I have been using this for my post page for a long time,

    Is this somehow affecting the above PHP’s?

    Thank You.

    • This reply was modified 4 years, 6 months ago by qph9697.
    Theme Author Tom

    (@edge22)

    Can you try this instead?:

    add_action( 'after_setup_theme', function() {
        remove_action( 'generate_after_header', 'generate_featured_page_header', 10 );
        add_action( 'generate_after_entry_header', 'generate_featured_page_header', 15 );
    } );

    Let me know ??

    Thread Starter qph9697

    (@qph9697)

    Hi Tom,

    add_action( ‘after_setup_theme’, function() {
    remove_action( ‘generate_after_header’, ‘generate_featured_page_header’, 10 );
    add_action( ‘generate_after_entry_header’, ‘generate_featured_page_header’, 15 );
    } );

    This PHP worked. Thank You.

    I have one more question if I need to place the featured image below the 1st paragraph or excerpt on a post or page, then how can I do this?

    • This reply was modified 4 years, 6 months ago by qph9697.
    Theme Author Tom

    (@edge22)

    Hmm, not sure about that one. Maybe it would be better to just add the image inside the content?

    Thread Starter qph9697

    (@qph9697)

    Yes, the image would be much better.

    But as in I am using Structured Data and had configured that the image link for the structured data must be the featured image.
    And if I used image, then I will have to manually insert the image for the schema property.

    But still, it’s not an issue. The main issue for “featured image above title” is solved.

    Thank You Tom for the help. 🙂

    • This reply was modified 4 years, 6 months ago by qph9697.
    Theme Author Tom

    (@edge22)

    You could use a schema plugin to grab the featured image data and output the necessary schema. Then leave the add_action call out and it won’t re-add the featured image to the page itself.

    No problem ??

    Thread Starter qph9697

    (@qph9697)

    Okay sure I will try this.

    Thank You.

    Theme Author Tom

    (@edge22)

    You’re welcome ??

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Issue with Featured Image on Single Page’ is closed to new replies.