I want to add several images and divs and also customize the look of my Blog post listing… But i can’t find the way to do it.
Here’s the Blog Template code
<?php
/*
WARNING: This file is part of the core Genesis framework. DO NOT edit
this file under any circumstances. Please do all modifications
in the form of a child theme.
*/
/**
* Template Name: Blog
* This file handles blog post listings within a page.
*
* This file is a core Genesis file and should not be edited.
*
* The blog page loop logic is located in lib/structure/loops.php
*
* @category Genesis
* @package Templates
* @author StudioPress
* @license http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)
* @link http://www.studiopress.com/themes/genesis
*/
genesis();
and just above the genesis();
code.. i tried to put some divs and images there.. But i guess that’s not the way it works. ..
I also tried to make my own Blog listing template using a normal wordpress code theme..
<?php /*
Template Name: List Post Pages
*/
?>
<?php get_header(); ?>
<?php if ( has_post_thumbnail() ) { ?>
<div class="featured">
<?php the_post_thumbnail(); ?>
</div>
<?php } ?>
<div class="divider"></div>
<div id="content" class="hfeed">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href="https://wordpress.stackexchange.com/questions/108649/<?php the_permalink() ?>">
<?php the_title(); ?>
</a></h2>
<div class="entry">
<?php the_content(); ?>
</div>
<div class="postmetadata">
<?php the_tags('Tags: ', ', ', '<br />'); ?>
Posted in
<?php the_category(', ') ?>
|
<?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
</div>
</div>
<?php endwhile; ?>
<?php else : ?>
<h2>Not Found</h2>
<?php endif; ?>
<?php genesis_after_loop(); ?>
</div>
<?php get_footer(); ?>
But no luck, what’s the right way to do this?
***Update -code below is the one i want.. but instead of having the Content of the page. I want the list of Post with excerpts ….How can i do that????
<?php /*
Template Name: Page Template
*/ ?>
<?php get_header(); ?>
<?php if ( has_post_thumbnail() ) { ?>
<div class="featured">
<?php the_post_thumbnail(); ?>
</div>
<?php } ?>
<div class="divider"></div>
<?php genesis_before_content_sidebar_wrap(); ?>
<div id="content-sidebar-wrap">
<?php genesis_before_content(); ?>
<div id="content" class="hfeed">
<?php genesis_before_loop(); ?>
<?php genesis_loop(); ?>
<?php genesis_after_loop(); ?>
</div>
<!-- end #content -->
<?php genesis_after_content(); ?>
</div>
<!-- end #content-sidebar-wrap -->
<?php genesis_after_content_sidebar_wrap(); ?>
<?php get_footer(); ?>
1 Answer
You are going about this pretty much all wrong. You should read the instructions before continuing.
An Introduction to Child Themes
An Introduction to Hooks in the Genesis Framework for WordPress
The second code you provided can be rewritten as this:
// Template Name: Page Template
genesis();
That’s it. Genesis takes care of all that stuff you just wrote. But you need to read the instruction. Watch the video in the second link. You are making this much harder than it has to be.
***Update … instead of having the Content of the page. I want the list of Post[s] with excerpts …. [sic] How can [I] do that?
I couldn’t stand the idea of naming a page template Page Template
.
<?php
// Template Name: Excerpts
// Replace the loop.
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'genesis_custom_loop' );
// Change the content archive and loop args.
add_action( 'genesis_pre_get_option_content_archive', 'child_post_content_archive' );
add_filter( 'genesis_custom_loop_args', 'child_loop_args' );
genesis();
/**
* Change default content to excerpts on this page.
*/
function child_post_content_archive() {
return 'excerpts';
}
/**
* Use WP_Query args.
*
* @link {http://codex.wordpress.org/Function_Reference/WP_Query}
*/
function child_loop_args() {
return array(
posts_per_page => 5,
);
}