• Hey guys, im new to whole wordpress world and im loving every minute of it, i’ve recently set up a blog using a custom theme. It does not however show tags or the name of the author who posted (i have two authors on the site both have posted more than once) i have read up on the forums about inserting codes into the index.php (or loop file) but everytime i have done so it either displays the tag/author information outside of the post itself (onto the main body of the site) or directly at the bottom of the page (not the individual posts)

    Here is the code for the index.php:

    <?php get_header(); ?>
    
    <!--Blog-->
    <div id="blog" class="clearfix">
    
      <!--Articles-->
      <div class="articles">
    
        <?php if (have_posts()) : while (have_posts()) : the_post(); $format = get_post_format(); ?>
    
          <?php if($format == ''): ?>
    
            <?php get_template_part('library/functions/theme/formats/standar'); ?>
    
          <?php else: ?> 
    
            <?php get_template_part('library/functions/theme/formats/'.$format); ?>
    
          <?php endif; ?>
    
        <?php endwhile ?> 
    
        <?php else: ?>
    
        <h2>No posts were found.</h2>
    
        <?php endif ?>
    
      <!--End .articles-->
      </div>
    
      <?php	if(page_has_nav()) :	?>
    
        <!--Navigation-->
        <div id="postnavigation" class="clearfix">
          <!--Previous-->
          <span class="prev"><?php previous_posts_link('&laquo; Previous') ?></span>
    
          <!--Next-->
          <span class="next"><?php next_posts_link('Next &raquo;','') ?></span>
    
        <!--End .navigation-->
        </div>
    
      <?php	endif;	?>  
    
     <!--Sidebar-->
     <div id="sidebar">
    
       <?php get_sidebar(); ?>
    
     <!--End .sidebar-->
     </div>
    
    <!--End #blog-->
    </div>
    
    <?php get_footer(); ?>

    and here is the code for the standar.php

    <!--Article-->
    <div <?php post_class("article standard clearfix"); ?>>
    
      <!--Date-->
      <div class="date">
        <a title="<?php the_title(); ?>" href="<?php the_permalink() ?>"><?php the_date('M.j.Y'); ?></a>
      </div>
    
    	<!--Content-->
    	<div class="content clearfix">
    
    	  <!--Title-->
    	  <?php $title = get_post_meta($post->ID, 'post_header', true); if (!$title) $title = $post->post_title; ?>
    	  <h2 class="title"><a	href="<?php the_permalink() ?>"	title="<?php the_title(); ?>"><?php	echo $title;	?></a></h2>	  
    
          <?php the_content("Read the full story"); ?>
    
    	  <?php include("social.php"); ?>
    
    	<!--End .content-->
    	</div>
    
    <!--End .article-->
    </div>

    this is the page.php code

    <?php get_header(); ?>
    
    <!--Blog-->
    <div id="blog" class="clearfix">
    
      <!--Articles-->
      <div class="articles single">
    
        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
          <!--Article-->
          <div <?php post_class("article standard clearfix"); ?>>
    
          	<!--Content-->
          	<div class="content clearfix">
    
          	  <!--Title-->
          	  <?php $title = get_post_meta($post->ID, 'post_header', true); if (!$title) $title = $post->post_title; ?>
          	  <h2 class="title"><a	href="<?php the_permalink() ?>"	title="<?php the_title(); ?>"><?php	echo $title;	?></a></h2>	  
    
          	  <?php the_content("Read the full story"); ?>
    
          	<!--End .content-->
          	</div>
    
          <!--End .article-->
          </div>
    
        <?php endwhile ?>
    
          <?php comments_template('', true ); ?>
    
        <?php endif ?>
    
      <!--End .articles-->
      </div>
    
    <!--End #blog-->
    </div>
    
    <?php get_footer(); ?>

    any help would be hugely apreciated! thanks

Viewing 15 replies - 1 through 15 (of 15 total)
  • You should add your code above or below include(‘social.php’); line in standar.php

    Thread Starter diderkamal

    (@diderkamal)

    ok i will try that and let you know the results

    Thread Starter diderkamal

    (@diderkamal)

    unfortunately i have posted the code <?php the_author() ?> above social.php, below it and even next to it, to no avail? is there a different code i should be using to have author names show up?

    Did you mistype here only — or in the code too??

    you missed the terminator(;) in the statement.

    Thread Starter diderkamal

    (@diderkamal)

    i typed in <?php the_author() ?> exactly as it, where do i put the (;) ? at the end of the code?

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    After the closing parentheses.

    after the parenthesis :: <?php the_author(); ?>

    Thread Starter diderkamal

    (@diderkamal)

    ok i have updated the code with the correction and there is no change. I was wondering though. looking at library/fuctions/theme/formats directory, there are .php files for ‘audio’ ‘gallery’ ‘image’ ‘quote’ ‘social’ ‘standar’ and ‘video’. should there be a author.php file and tag.php file present in order for them to be shown? sorry im still a little bit new to all this, still a learning curve for me

    No — that is not required.
    As you can fetch the post-content, and already in the Loop == you should be able to use that piece of code to get the author name.

    Can you post a link to your site?

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Template hierarchy files is what you are looking at.

    Thread Starter diderkamal

    (@diderkamal)

    https://theswitchscene.cu.cc/

    i wanted to add the author name and tags next to the social buttons at the bottom of my posts

    It seems like — the post — above — on the front page — of your site are not standard post..
    Create a new post — with some text.
    It should appear on the top, with the author name.

    For these posts, you will need all php files in your formats directory.

    These are post formats — video, audio etc.

    Thread Starter diderkamal

    (@diderkamal)

    i see, i have made a new post with just text and it has posted the author name, above the social icons, instead of to the side of it. but when i create a post with media on it, it does not post the author name?

    For those posts, you will need to edit all php files in your formats directory.

    Thread Starter diderkamal

    (@diderkamal)

    Ok i understand now, and is there a way i can place the author name directly to the side of the social sharing buttons instead of directly above them? like a certain div code or somthing?

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Custom theme, how do i add tags/author name to end of every post’ is closed to new replies.