I am using a genesis child theme on a site and cannot figure out how to remove all the extra data that is displayed on the category view. When I currently look at a category this is what it looks like:
<blockquote>Post Title
July 26, 2012 By Admin
Lorem lupsum… [Read more...]
Filed Under: Category</blockquote>
I want to get rid of everything else except the post title.
Dbranes answers:
have you tried the genesis filters (http://www.studiopress.com/tutorials) ?
you could try these filters in your child theme's functions.php :
/** Customize the post info function */
add_filter( 'genesis_post_info', 'post_info_filter' );
function post_info_filter($post_info) {
if (is_category()) {
$post_info = '';
return $post_info;
}}
/** Customize the post meta function */
add_filter( 'genesis_post_meta', 'post_meta_filter' );
function post_meta_filter($post_meta) {
if (is_category()) {
$post_meta = '';
return $post_meta;
}}
/** Customize the post meta function */
add_filter( 'the_excerpt', 'post_excerpt_filter' );
function post_excerpt_filter($post_excerpt) {
if (is_category()) {
$post_excerpt = '';
return $post_excerpt;
}}
or try removing the hooks:
remove_action( 'genesis_before_post_content', 'genesis_post_info' );
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
with a category check?
badnews comments:
I already use the "remove action" bits to get rid of the post meta and info - however this gets rid of that info on the posts as well.
Getting rid of the post excerpt & read more link doesn't work with the code you provided.
Thanks
Dbranes comments:
you could try this to remove the excerpt/content :
remove_action( 'genesis_post_content', 'genesis_do_post_content' );
ps: you can always use CSS to hide it with "display:none;" ;-)
badnews comments:
remove_action( 'genesis_post_content', 'genesis_do_post_content' );
Already tried that last night. This hides the content on the post as well.
Dbranes comments:
so this combined is doing the job
remove_action( 'genesis_before_post_content', 'genesis_post_info' );
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
remove_action( 'genesis_post_content', 'genesis_do_post_content' );
but you only want it to be removed on category pages and !is_single() ?
Dbranes comments:
ps: here is one idea of a conditional remove_action:
add_action('genesis_before','remove_some_actitons');
function remove_some_actitons() {
if ( is_category()) { // <--- you could change this to your needs
remove_action( 'genesis_before_post_content', 'genesis_post_info' );
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
remove_action( 'genesis_post_content', 'genesis_do_post_content' );
}
}
badnews comments:
Thanks that works perfectly.
Agus Setiawan answers:
i can do this,
please give me an access to your dashboard.
badnews comments:
If at all possible. I'd like the instructions.
Thanks.
Agus Setiawan comments:
send private message to me, or email to admin at masaguz dot com
- an access to your ftp
Michael Caputo answers:
Can you post your single.php code?
badnews comments:
<?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.
*/
/**
* This file handles posts, but only exists for the sake of
* child theme forward compatibility.
*
* This file is a core Genesis file and should not be edited.
*
* @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();
Doesn't look like there is much in here :|.
Michael Caputo comments:
How about of your child theme... Sorry, should have been more specific.
badnews comments:
There is only 3 php files in the child theme.
home.php
functions.php
page_landing.php
Sorry.
Michael Caputo comments:
What version of the framework do you have
badnews comments:
Version: 1.8.2
Michael Caputo comments:
So exactly what 'extra data' do you want to remove?
badnews comments:
Post Title
July 26, 2012 By Admin
Lorem lupsum… [Read more...]
Filed Under: Category
Out of everything that is there, I just want to keep the Post Titles.
idavinder answers:
// remove post data on category page except post title
remove_action('genesis_after_post_content', 'genesis_post_meta');
remove_action('genesis_before_post_content', 'genesis_post_info');
remove_action('genesis_post_content', 'genesis_do_post_content');
add_action('template_redirect', 'child_conditional_actions');
function child_conditional_actions() {
if( is_single() ) {
add_action('genesis_after_post_content', 'genesis_post_info');
add_action('genesis_after_post_content', 'genesis_post_meta');
add_action('genesis_post_content', 'genesis_do_post_content');
}}
Above should solve the issue at hand :)