Syahir Hakim
KeymasterKuala Lumpur, Malaysia
When not perched on my workspace, I tremendously enjoy hiking in the bushes and climbing mountains. They serve as much-needed refuges from the pretense of cities.
Forum Replies Created
-
Admin
Please create a new topic for the separate issue.
Admin
You can add this to the child theme’s
functions.phpfile:/**
* Add custom body class
*/
function my_body_class( $classes ) {
$parent_id = 65; /* Change to the ID of the parent page */
$current_post = get_post( $post_id );
if ( in_array( $parent_id, array( $current_post->ID, $current_post->post_parent ) ) ) $classes[] = 'a-main';
return $classes;
}
add_action( 'body_class', 'my_body_class' );That will add the
.a-mainclass to the<body>element, so you can use that to prefix the CSS codes to be applied to those pages.Admin
Marking thread as resolved. You can do this yourself as well.
Admin
It’s showing in that category too. If it doesn’t show for you, it’s probably because AdSense has no ads yet for you, but as far as I can tell it is working properly.
Admin
Did you change the
$parent_idto the actual ID of the parent page, i.e. the page with thea-mainslug?Admin
Ah, sorry the code was missing a single closing parentheses. I’ve corrected the above code. Please try again.
Admin
Did you try the last code I provided?
Admin
Ah… in your site there is only one page that contains
a-mainin its slug. The other pages are children of that page, but do not havea-mainin their slugs. Try this then:/**
* Manually set different header image for individual pages
*/
function graphene_custom_header_image( $img_url, $post_id = false ){
if ( ! $post_id ) return $img_url;
$parent_id = 65; /* Change to the ID of the parent page */
$current_post = get_post( $post_id );
if ( in_array( $parent_id, array( $current_post->ID, $current_post->post_parent ) ) ) return 'http://www.new-image.url';
return $img_url;
}
add_filter( 'graphene_header_image', 'graphene_custom_header_image', 10, 2 );10is the priority for the function, while2is the number of arguments it accepts.Admin
Try this:
/**
* Manually set different header image for individual pages
*/
function graphene_custom_header_image( $img_url, $post_id = false ){
if ( ! $post_id ) return $img_url;
$current_post = get_post( $post_id );
if ( stristr( $current_post->post_name, 'a-main' ) !== false ) return 'http://www.new-image.url';
return $img_url;
}
add_filter( 'graphene_header_image', 'graphene_custom_header_image', 10, 2 );Admin
In reply to: WordPress database error from graphene_get_comment_count()
June 24, 2013 at 2:27 am #38844Try adding this code to the top of the
graphene_get_comment_count()function and see if the error is still showing up:if ( ! get_the_ID() ) return;
