How to Add Link on Blog Page Above Blogs

Hello. I have Latest X Theme and I would like to know how to add a link to the top of my blog on the blog page. My site is not yet ready so please do not give the url out yet. Thank you. http://www.thosecrazyvegans.net/blog

PS. I also do not want the text to be right above the blogs, but there to be a little line space between the blog and text link.

Hi There,

This needs custom codes. See this guide. The template responsible for that can be wp-index.php from this folder: wp-content\themes\x\framework\views\ethos. Feel free to copy the file on the same folder on your child theme here: wp-content\themes\x-child\framework\views\ethos. Edit the file as intended. Add the link tags. To make sure it will work on blog page only, we have to use wordpress blog filter function.

Hope this helps.

Hello Lely, and thank you for replying. It is strange why I cannot just post to the blog page text area? Some great information you’ve posted. I just do not know where to post the code into the wp-index.php page.

Add a Blog

Thanks a bunch. :slight_smile:

Hi,

That is a standard practice for wordpress. If you check other themes that is how it works too.

You can add your code after this line.

      <div class="<?php x_main_content_class(); ?>" role="main">

Thanks

Hi Paul. I added my code (Add Your Blog) just after the line and nothing happens.

Hey There,

Can you please post in your next reply the complete code you have added in the wp-index.php file so that we can check it?

Thank you in advance.

I was told I need to add the following code to themes index.php

<?php if ( 'page' == get_option('show_on_front') && get_option('page_for_posts') && is_home() ) : the_post(); $page_for_posts_id = get_option('page_for_posts'); setup_postdata(get_page($page_for_posts_id)); ?>
<div id="post-<?php the_ID(); ?>" class="page">
	<div class="entry-content">
		<?php the_content(); ?>
		<?php edit_post_link('Edit', '', '', $page_for_posts_id); ?>
	</div>
</div>
<?php rewind_posts(); endif; ?>

How to do this? Where is the index.php page?

I found the page under x-child > views > ethos

The entire code is

<?php // ============================================================================= // VIEWS/ETHOS/WP-INDEX.PHP // ----------------------------------------------------------------------------- // Index page output for Ethos. // ============================================================================= $is_filterable_index = is_home() && x_get_option( 'x_ethos_filterable_index_enable' ) == '1'; ?> <?php get_header(); ?>
<?php x_get_view( 'ethos', '_post', 'slider' ); ?>

<div class="offset cf">
  <div class="<?php x_main_content_class(); ?>" role="main">

Add Your Blog

    <?php if ( $is_filterable_index ) : ?>
      <?php x_get_view( 'ethos', '_index' ); ?>
    <?php else : ?>
      <?php x_get_view( 'global', '_index' ); ?>
    <?php endif; ?>

  </div>

  <?php get_sidebar(); ?>

</div>
<?php get_footer(); ?>

This is the site I got the code from
http://webdesignfromscratch.com/wordpress/wordpress-tip-1-page-content-on-the-posts-page

Hi,

The code looks correct.

Please make sure the file is in wp-content/themes/x-child/framework/views/ethos

If that doesn’t help, kindy provide us your ftp login in Secure Note.

For some reason the secure note posted above. Thanks

Hi There,

By default, blog index page content is controlled by a template and cannot be edited using any page builder. That’s the reason why we heave to edit templates.

What you did is correct. You can’t see the result on frontend page probably because of cache. Try to clear cache and check again. See this: https://screencast-o-matic.com/watch/cbQFcuIqrN

Also I notice that on your child theme folder public_html/wp-content/themes/x-child/views/ethos, you have so many files in there. Did you customize all this files? Note that you only need to copy the files that you have customized/edited.

Hope this helps.

Thanks. So it works on your end? Because my friend and I tried on our phone es and didn’t. I did clear cache. Also I just copied all the files to child folder.

Still did not work. We tried 2 different phones. Multiple browsers, cleared cache

Hi there,

Would you mind providing your admin login credentials as well? It’s because the Edit URL will only work while logged in.

For the meantime as a recap, do you wish to add static content above the blog posts (index page) and add Edit link for each post? Or is it something else, like you expect to edit the blog index page from the editor? That’s not currently possible.

And yes, I don’t see any change either, the text that’s displaying there is from the sidebar. Though, your code should be correct and working.

Thanks!