Replacing parent function in child theme
-
Plz excuse my ignorance. I’ve set the column mode to 3 (small-large-small), and that’s what I want for the home page. But for the blog posts I want 2 columns (small-large). Where do I place the above code provided by Syahir??
I’m still in version 1.6. Will this work in 1.6 or should i first upgrade to 1.7?
Thanks!
Ramy
Admin
@ramyos, you would need to create a child theme, and then place the code inside the
functions.phpin your child theme.See this wiki page for instructions on setting up a child theme:
http://wiki.khairul-syahir.com/graphene-theme/wiki/Customisation_using_a_child_theme
keep in mind that in Graphene 1.7 something is changed in the function
graphene_column_mode().two-col-leftis nowtwo_col_left(divis replaced by underscore).The function to add in your child theme could be:
function graphene_modify_column_mode(){
global $graphene_settings;
if ((is_single()||is_page())&&!(class_exists( 'bbPress' ) && is_bbpress()))
$graphene_settings['column_mode'] = 'two_col_left';
}
add_action( 'template_redirect', 'graphene_modify_column_mode' );This takes into account also the possibility to set a specific column mode for bbpress forum plugin, and sets two columns as standard template for pages too.
EDIT
I see now that you want the small column on the left, then you have to change two_col_left with two_col_right, I suppose…
Thanks for responding so quickly 🙂
I tried it but it’s not working. I put your code into the functions.php in the child theme. And I get the following message:
Warning: Cannot modify header information – headers already sent by (output started at /home/content/32/8925832/html/wp-content/themes/graphene-child-theme/functions.php:9) in /home/content/32/8925832/html/wp-admin/theme-editor.php on line 103
Here’s my issue again: I set my display options to 3 columns (sidebar left and right). This is shown on the home page. But I’m trying to get the blog page and posts to be 2 columns (sidebar left). I’m not sure what I’m doing wrong.
I don’t know what happened!
Nothing is working in WP. I’m locked out of my wordpress account and it says:
function graphene_modify_column_mode(){ global $graphene_settings; if ( is_single( 452 ) ) $graphene_settings = ‘two-col-left’; } add_action( ‘template_redirect’, ‘graphene_modify_column_mode’ );
Warning: Cannot modify header information – headers already sent by (output started at /home/content/32/8925832/html/wp-content/themes/graphene-child-theme/functions.php:9) in /home/content/32/8925832/html/wp-login.php on line 349
Warning: Cannot modify header information – headers already sent by (output started at /home/content/32/8925832/html/wp-content/themes/graphene-child-theme/functions.php:9) in /home/content/32/8925832/html/wp-login.php on line 361
Warning: Cannot modify header information – headers already sent by (output started at /home/content/32/8925832/html/wp-content/themes/graphene-child-theme/functions.php:9) in /home/content/32/8925832/html/wp-includes/pluggable.php on line 669
Warning: Cannot modify header information – headers already sent by (output started at /home/content/32/8925832/html/wp-content/themes/graphene-child-theme/functions.php:9) in /home/content/32/8925832/html/wp-includes/pluggable.php on line 670
Warning: Cannot modify header information – headers already sent by (output started at /home/content/32/8925832/html/wp-content/themes/graphene-child-theme/functions.php:9) in /home/content/32/8925832/html/wp-includes/pluggable.php on line 671
Warning: Cannot modify header information – headers already sent by (output started at /home/content/32/8925832/html/wp-content/themes/graphene-child-theme/functions.php:9) in /home/content/32/8925832/html/wp-includes/pluggable.php on line 866
Lol. Yeah I had to delete the functions file.
This is what I had in the child functions.php:
function graphene_modify_column_mode()
{ global $graphene_settings; if ( is_single( 452 ) )
$graphene_settings = ‘two-col-left’; }
add_action( ‘template_redirect’, ‘graphene_modify_column_mode’ );
Admin
Add this line at the very top of your child theme’s
functions.phpfile:<?php
Viewing 10 posts - 11 through 20 (of 20 total)
- 1
- 2
- You must be logged in to reply to this topic.
