• I have been working with the scrawl theme, and customising it for a site.

    I would like to enable featured images on pages (currently only available in single posts).

    All of my attempts thus far have been unsuccessful. Anyone able to assist?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Kathryn Presner

    (@zoonini)

    Hi avolve, Scrawl already allows featured-image uploads in the dashboard, so you just need to display them on the front end. You can accomplish that by creating a child theme with some template-file modifications.

    Using a child theme means your tweaks won’t be overwritten when updating the theme. Here are some guides in case you haven’t made one before:

    https://codex.www.ads-software.com/Child_Themes
    https://op111.net/53/
    https://vimeo.com/39023468

    The file you’ll want to copy into your child theme is content-page.php and the function you’ll want to add there is this one:

    https://codex.www.ads-software.com/Function_Reference/the_post_thumbnail

    You’ll also need to add some CSS styling to the featured image to get it displayed how you like.

    This should point you in the right direction – if you get stuck anywhere along the way, let me know. A link to your site is also always helpful.

    Thread Starter avolve

    (@avolve)

    Appreciate the reply Karen.

    I am working on a child theme, and I can’t share a link as I am developing the site on a local machine.

    I have added has_post_thumbnail to content-page (mirroring what is in content-single) and edited header.php, changing

    if ( is_single() && has_post_thumbnail() ) : ?>`

    to

    if ( is_single() && has_post_thumbnail() || is_page() && has_post_thumbnail() ) : ?>

    Where I am a little stuck (assuming I have not made any mistakes, is the syntax for adding is_page to the function scrawl_featured_header:

    if ( ! has_post_thumbnail() || ! is_single() )

    In the parent theme function.php to test (and I am a bit lost in trying to this function — and functions in general — in the child theme function.php)

    Thanks!

    Moderator Kathryn Presner

    (@zoonini)

    Hiya, did you ever get this sorted out? I did some testing and it isn’t as straightforward as I’d hoped to display the featured image on pages in addition to posts in Scrawl. Let me know if you got it sorted and we’ll take it from there!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Featured images on pages (in addition to posts)’ is closed to new replies.