Custom content above first post on front page only


For the record my site is within a local development environment so I will not be able to post any links. Due to the nature of my question I doubt that would be necessary though, but I just thought I’d mention it.

I need help! Let’s get down to it:

I’m currently not using a static front page because I like how Sparkling handles everything as is.

However, I simply want to be able to add custom content on the first page of posts only (which is my front page) that will appear above the latest post. For example; add a widget or any other custom code that is unique to that page only.

I have the right sidebar active site-wide, and want this content to appear above the first post but inside of the post column (so to the right of the sidebar, not above everything like the slider - which I have deactivated).

I’ve tinkered with page.php and adding anything to that will add it to all pages.

I’ve also copied page.php and renamed it to front-page.php but that still affects all pages, and also breaks the design (excerpts turn into full posts, link to page 2 disappears, etc.).

After researching the support forums here, I understand that creating a static front page may resolve my issue, but if there is a possible solution without doing so that would be much more ideal.

Regardless, if a static front page is my only choice… how would I go about creating a static front page that is an exact replica of the normal first page of posts and allows custom code or widgets? Also, once that is done how can I tell the theme to ignore the old “page1” to avoid having duplicate content?

I appreciate any help offered. I’ve been a lurker here for a while and this is the first time I either couldn’t find a solution already existing on the forums or figuring it out on my own.

P.S. This code in content-page.php:

      // Checks if this is homepage to enable homepage widgets
      if ( is_front_page() ) :
        get_sidebar( 'home' );

Is there any way to add a line within that if conditional statement like “is_first_page” or “is_home” that will allow the insertion of custom code that will display on first page of posts only?


Anyone have any ideas?

This is still driving me crazy.

Hi @krisbap,

I hope you are well today and thank you for your question.

You can try achieving this by using the attached custom child theme of Sparkling theme that contains your shared custom code in its index.php file.

Best Regards,