[CustomPress] Add Featured Image to single-[post_type].php without back end access

I am unable to edit files in the ditor in WP and via FTP because Unable to communicate back with site to check for fatal errors, so the PHP change was reverted. You will need to upload your PHP file change by some other means, such as by using SFTP.

I'm just wondering if there is another way to add the featured image to the front of the post like a standard blog post would… without having any kind of back end access.

I've searched the depths of the plugins repository at wordpress.org

Any advice?

  • Nithin Ramdas
    • Support Wizard

    Hi Rachel,

    I’m just wondering if there is another way to add the featured image to the front of the post like a standard blog post would… without having any kind of back end access.

    I’m afraid, there isn’t any out of the box setting regrading this in the plugin side. The standard blog post displays featured images based on the code added inside the single.php file in the theme side, which would be the_post_thumbnail() function to display the featured image:

    https://developer.wordpress.org/reference/functions/the_post_thumbnail/

    I’m afraid, you’ll have to do the same by editing the template in the backend side. If you are still looking to add it via frontend, maybe the following plugin might help, which also helps with displaying custom post type:

    https://wordpress.org/plugins/display-posts-shortcode/

    https://github.com/billerickson/display-posts-shortcode/wiki

    Please note that I haven’t extensively tested the above plugin, it’s up to you to test, and see whetehr it fits to your needs.

    Regards,

    Nithin

  • Rachel
    • Flash Drive

    HI Nithin,

    I am familiar with this plugin. It is mainly for nicely showing lists of posts. It wouldn’t meet my needs for customizing the appearance of a single entry.

    Thanks for the response.

    I guess I don’t understand why the featured image is showing, since all the rest of the same post functions are being called when you create a custom post type through CustomPress. Surely it’s not a theme limitation, because the theme posts have featured images. Does that make sense?

    • Ash
      • Code Norris

      Hello Rachel

      Theme posts and custom posts are using different template. In your post template file, there is defined to show featured images, that’s why it works for posts.

      For custom post type, if there is no CPT specific file, it usually uses page.php or index.php and most of the time featured images are not shown there.

      You can copy single.php file and paste into the same theme root folder, rename it to single-{post_type_name}.php (without the curly braces). Then that file be used to single CPT and featured image would be there.

      Hope it helps! Please feel free to ask more questions if you have any.

      Have a nice day!

      Cheers,

      Ash