• Hi. I have a problem. Downloading a new template and it wanted to create a blog page.but I do not see the side that it is possible to select blog, contact and portfolio. Do you know how to add a blog template?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Shailesh

    (@shaileshsavaliya)

    You mean theme….?
    Template means new theme for blog??

    Thread Starter BRIUSLIS

    (@briuslis)

    Shailesh

    (@shaileshsavaliya)

    Create new empty php file for your template.
    You can use below code on top of this empty file.

    /**
     * Template Name: Your Template Name Here
    **/

    After than you can do your custom code as you wish…

    Thread Starter BRIUSLIS

    (@briuslis)

    thanks it works;) I recently started using WP and I suspect not in PHP. So maybe I could copy the code part of the original template? just do not know from whom?

    Shailesh

    (@shaileshsavaliya)

    Yes, you can copy code from original template.
    And after than you can change HTML of this template as you required.

    Thread Starter BRIUSLIS

    (@briuslis)

    A copy of any file? as the file is named in the original template? tried almost all

    Shailesh

    (@shaileshsavaliya)

    If your portfolio data will come from post than you can copy index.php code for get post.

    Now if you have set category for portfolio than you can use query_posts() function.
    http://codex.wordpress.org/Template_Tags/query_posts
    Set function parameter as you required… and
    Put this function before while loop.
    Actually you want while loop from index.php

    Thread Starter BRIUSLIS

    (@briuslis)

    I found a file which I understand is the blog code. Maybe there something missing? because it does not post

    <?php get_header();?>
    
    <?php global $dox_options; ?>
    <!-- #single-post -->
    <div id="single-post" class="container">
    	<div class="container_12 clearfix">
    		<div class="grid_12"><h3 class="page-title"><?php _e('Autotrader Blog', 'autotrader') ?></h3></div>
    
    		<!-- #content -->
    		<div id="content" class="grid_8">
    			<?php if (have_posts()) : while (have_posts()) : the_post();
    
    				/* get permalink */
    				$permalink = get_permalink(get_the_ID());
    			?>
    
    			<!-- .post -->
    			<div <?php post_class('clearfix') ?> id="post-<?php the_ID(); ?>">
    
    				<div class="post-image"><?php echo dox_get_post_image($post->ID, 'default-thumb', 'blog', false); ?></div>
    
    				<!-- .post-container -->
    				<div class="post-container grid_8 alpha">
    					<h3 class="blog-title"><?php the_title(); ?></h3>
    
    					<div class="post-meta grid_2 alpha">
    
    						<!-- .post-meta-data -->
    						<div class="post-meta-data">
    							<span class="posted"><?php the_time( get_option('date_format') ) ?></span>
    							<span class="author"><?php the_author_posts_link(); ?></span>
    							<span class="comment"><?php comments_popup_link(__('No comments', 'autotrader'), __('1 Comment', 'autotrader'), __('% Comments', 'autotrader')); ?></span>
    							<span class="tags"><?php $tags = wp_get_post_tags($post->ID); if(! empty($tags)) { $tag_link = get_tag_link($tags[0]->term_id); echo '<a href="'.$tag_link.'">'.$tags[0]->name.'</a>'; } ?></span>
    						</div><!-- .post-meta-data -->
    
    						<!-- .social-buttons -->
    						<div class="social-buttons">
    
    							<span class="twitter"><a href="http://twitter.com/share?url=<?php echo $permalink; ?>&text=<?php echo get_the_title(); ?>&via=<?php echo $dox_options['footer']['twitter']; ?>" class="twitter-share-button" data-count="horizontal"><?php _e('Tweet this article', 'autotrader'); ?></a></span>
    							<span class="google"><div class="g-plusone" data-size="medium" data-href="<?php echo $permalink; ?>"></div></span>
    							<span class="facebook"><div id="fb-root"></div><div class="fb-like" data-href="<?php echo $permalink; ?>" data-send="false" data-layout="button_count" data-width="100" data-show-faces="false" data-font="arial"></div></span>
    							<div class="clear"></div>
    						</div><!-- end - .social-buttons -->					
    
    					</div>
    
    					<!-- .post-data -->
    					<div class="post-data grid_6 omega">
    						<div class="entry-content">
    						<?php the_content(); ?>
    						</div>
    					</div><!-- .post-data -->
    
    				</div><!-- end - .post-container -->				
    
    			</div><!-- end - .post -->
    
    			<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    
    			<?php comments_template(); ?>  
    
    			<?php endwhile; endif; ?>	
    
    		</div><!-- end - #content -->
    
    		<!-- #sidebar -->
    		<div id="sidebar" class="grid_4">
    			<?php if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar('Blog Sidebar') ) ?>
    		</div><!-- end - #sidebar -->		
    
    		<div class="clear"></div>
    	</div>
    </div>
    <div class="clear"></div>
    <!-- end - #single-post -->
    
    <?php get_footer(); ?>

    Shailesh

    (@shaileshsavaliya)

    This is the single page template single post use this template to display.
    You can use below code for your post and please study query_posts() function and use it.

    <?php if (have_posts()) : while (have_posts()) : the_post();
    
    				/* get permalink */
    				$permalink = get_permalink(get_the_ID());
    			?>
    
    			<!-- .post -->
    			<div <?php post_class('clearfix') ?> id="post-<?php the_ID(); ?>">
    
    				<div class="post-image"><?php echo dox_get_post_image($post->ID, 'default-thumb', 'blog', false); ?></div>
    
    				<!-- .post-container -->
    				<div class="post-container grid_8 alpha">
    					<h3 class="blog-title"><?php the_title(); ?></h3>
    
    					<div class="post-meta grid_2 alpha">
    
    						<!-- .post-meta-data -->
    						<div class="post-meta-data">
    							<span class="posted"><?php the_time( get_option('date_format') ) ?></span>
    							<span class="author"><?php the_author_posts_link(); ?></span>
    							<span class="comment"><?php comments_popup_link(__('No comments', 'autotrader'), __('1 Comment', 'autotrader'), __('% Comments', 'autotrader')); ?></span>
    							<span class="tags"><?php $tags = wp_get_post_tags($post->ID); if(! empty($tags)) { $tag_link = get_tag_link($tags[0]->term_id); echo '<a href="'.$tag_link.'">'.$tags[0]->name.'</a>'; } ?></span>
    						</div><!-- .post-meta-data -->
    
    						<!-- .social-buttons -->
    						<div class="social-buttons">
    
    							<span class="twitter"><a href="http://twitter.com/share?url=<?php echo $permalink; ?>&text=<?php echo get_the_title(); ?>&via=<?php echo $dox_options['footer']['twitter']; ?>" class="twitter-share-button" data-count="horizontal"><?php _e('Tweet this article', 'autotrader'); ?></a></span>
    							<span class="google"><div class="g-plusone" data-size="medium" data-href="<?php echo $permalink; ?>"></div></span>
    							<span class="facebook"><div id="fb-root"></div><div class="fb-like" data-href="<?php echo $permalink; ?>" data-send="false" data-layout="button_count" data-width="100" data-show-faces="false" data-font="arial"></div></span>
    							<div class="clear"></div>
    						</div><!-- end - .social-buttons -->					
    
    					</div>
    
    					<!-- .post-data -->
    					<div class="post-data grid_6 omega">
    						<div class="entry-content">
    						<?php the_content(); ?>
    						</div>
    					</div><!-- .post-data -->
    
    				</div><!-- end - .post-container -->				
    
    			</div><!-- end - .post -->
    
    			<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    
    			<?php comments_template(); ?>  
    
    			<?php endwhile; endif; ?>
    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Moving to the Themes section. This isn’t Multisite Specific 🙂

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘template doesn't have blog template’ is closed to new replies.