• Hello,

    I am getting deeper and deeper into the world of WordPress and I am trying to achieve something I have not tried before.

    My goal is:

    In my reading settings I have set my Blog page to the page I want my blog.

    However, that means that any content added to this particularly page, is overridden by your posts. Every other page of my site has a logo and title I make by using Visual Composer. I would like to be able to have this logo and title visible above the posts on the blog page.

    I did my research and found an article which gave me some coding I could add to my themes index.php file. I tried adding the code but got an error message.

    Having never worked with php files I am not sure where to add it amongst the text that is already there.

    This is the code I found:

    <?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;
    ?>

    and this is the what is currently in the index.php file I believe I need to edit:

    <?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(); ?>
    
      <div class="x-container max width main">
    
        <?php x_get_view( 'ethos', '_post', 'slider' ); ?>
    
        <div class="offset cf">
          <div class="<?php x_main_content_class(); ?>" role="main">
    
            <?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>
      </div>
    
    <?php get_footer(); ?>

    Could anyone advise me on how where to add the new code within this file.

    Thank you,

    Daniel

The topic ‘Help editing index.php’ is closed to new replies.