Created
January 8, 2014 17:22
-
-
Save konradsroka/8320631 to your computer and use it in GitHub Desktop.
For Custom Community Theme versions 1.x // Adding some content at the place where the slideshow container sits usually.. // in this example we call the slideshow from the nice plugin "SlideDeck 2" from wordpress.org
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is the action hook to add stuff above the content.. | |
add_action( 'bp_after_header', 'cc_add_above_content' ); | |
// this is the function to add stuff above the content.. | |
function cc_add_above_content() { | |
// first, add a wrapper around. | |
echo '<div style="margin: 10px 0;">'; | |
// by the way: you can remove the margin if you want no spacing there, or modify to what you like. | |
// now we add the actual content! | |
// Call any php function or a shortcode by just dropping your shortcode inside! | |
echo do_shortcode( '[SlideDeck2 id=112]' ); | |
// another tip: make sure whatever you put inside is wide enough | |
// = 100% or your website width.. | |
// now close your wrapper | |
echo '</div>'; | |
} | |
// end of the function cc_add_above_contet(). boom! |
Some short explanations:
- is_frontpage() checks if it is your main front page
- is_home() checks if it is on blog homepage, which does not need to be your main homepage! ;)
- "||" in PHP means "or" -> you can also write "&&" which means "and"
- you could write like this too:
if( is_front_page() || is_home() ) {
add_action( 'bp_after_header', 'cc_add_above_content' );
}
but if you want to add more things "inside" the if-statement it would only work with the brackets.. ;)
happy creating! konrad
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
// if you want to just show it on blog homepage and static front page...
// just do the same action hook - with an if-statement around, see:
if( is_front_page() || is_home() )
add_action( 'bp_after_header', 'cc_add_above_content' );