Community Forums › Forums › Archived Forums › Design Tips and Tricks › Slider shows up on every page
- This topic has 3 replies, 2 voices, and was last updated 10 years, 9 months ago by alliechynna.
-
AuthorPosts
-
July 12, 2013 at 6:43 am #50348alliechynnaMember
What php do I need to add/change so that my slider only shows up on the home page
http://alliechynna.comJuly 12, 2013 at 6:59 am #50352Brad DaltonParticipantif ( is_home() ) {
See this code if you selected to display latest posts in the reading settings.
orif (is_front_page() ) {
Use this code if using a static page as your home page
July 12, 2013 at 3:32 pm #50464alliechynnaMemberThanks were about in my php do I need to add the first pice of code
<?php
/** Start the engine */
require_once( get_template_directory() . '/lib/init.php' );load_child_theme_textdomain( 'fabric8ted', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'fabric8ted' ) );
/** Child theme (do not remove) */
define( 'CHILD_THEME_NAME', __( 'fabric8ted Theme', 'fabric8ted' ) );
define( 'CHILD_THEME_URL', 'http://my.studiopress.com/themes/fabric8ted' );/** Add Viewport meta tag for mobile browsers */
add_action( 'genesis_meta', 'fabric8ted_add_viewport_meta_tag' );
function fabric8ted_add_viewport_meta_tag() {
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0"/>';
}/** Add support for custom header */
add_theme_support( 'genesis-custom-header', array(
'width' => 1140,
'height' => 150
) );/** Add support for custom background */
add_theme_support( 'custom-background' );/** Add home top widget area */
add_action( 'genesis_before_loop', 'fabric8ted_home_slider' );
function fabric8ted_home_slider() {
dynamic_sidebar( 'home-slider' );
}/** Sets Content Width */
$content_width = apply_filters( 'content_width', 680, 680, 1020 );/** Create additional color style options */
add_theme_support( 'genesis-style-selector', array(
'fabric8ted-purple' => __( 'Purple', 'fabric8ted' ),
'fabric8ted-blue' => __( 'Blue', 'fabric8ted' ),
'fabric8ted-green' => __( 'Green', 'fabric8ted' ),
) );/** Unregister layout settings */
genesis_unregister_layout( 'content-sidebar-sidebar' );
genesis_unregister_layout( 'sidebar-content-sidebar' );
genesis_unregister_layout( 'sidebar-sidebar-content' );/** Unregister secondary sidebar */
unregister_sidebar( 'sidebar-alt' );/** Add new image sizes */
add_image_size( 'featured', 285, 100, TRUE );
add_image_size( 'slider', 1140, 445, TRUE );/** Change the default comment callback */
add_filter( 'genesis_comment_list_args', 'fabric8ted_comment_list_args' );
function fabric8ted_comment_list_args( $args ) {
$args['callback'] = 'fabric8ted_comment_callback';
return $args;
}/** Customize the comment section */
function fabric8ted_comment_callback( $comment, $args, $depth ) {$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?> id="comment-<?php comment_ID() ?>">
<?php do_action( 'genesis_before_comment' ); ?>
<div class="comment-header">
<div class="comment-author vcard">
<?php echo get_avatar( $comment, $size = $args['avatar_size'] ); ?>
<?php printf( '<cite class="fn">%s</cite> <span class="says">%s:</span>', get_comment_author_link(), apply_filters( 'comment_author_says_text', __( 'says', 'fabric8ted' ) ) ); ?>
<div class="comment-meta commentmetadata">
comment_ID ) ); ?>"><?php printf( '%1$s ' . __( 'at', 'fabric8ted' ) . ' %2$s', get_comment_date(), get_comment_time() ); ?>
<?php edit_comment_link( __( 'Edit', 'fabric8ted' ), g_ent( '• ' ), '' ); ?>
</div><!-- end .comment-meta -->
</div><!-- end .comment-author -->
</div><!-- end .comment-header --><div class="comment-content">
<?php if ( $comment->comment_approved == '0' ) : ?>
<p class="alert"><?php echo apply_filters( 'genesis_comment_awaiting_moderation', __( 'Your comment is awaiting moderation.', 'fabric8ted' ) ); ?></p>
<?php endif; ?><?php comment_text(); ?>
</div><!-- end .comment-content --><div class="reply">
<?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
</div><?php do_action( 'genesis_after_comment' );
/** No ending tag because of comment threading */
}
/** Add support for 3-column footer widgets */
add_theme_support( 'genesis-footer-widgets', 3 );/** Register widget areas **/
genesis_register_sidebar( array(
'id' => 'home-slider',
'name' => __( 'Home - Slider', 'fabric8ted' ),
'description' => __( 'This is the slider section on the home page.', 'fabric8ted' ),
) );
genesis_register_sidebar( array(
'id' => 'home-top',
'name' => __( 'Home - Top', 'fabric8ted' ),
'description' => __( 'This is the top section of the home page.', 'fabric8ted' ),
) );
genesis_register_sidebar( array(
'id' => 'home-cta',
'name' => __( 'Home - Call To Action', 'fabric8ted' ),
'description' => __( 'This is the call to action section on the home page.', 'fabric8ted' ),
) );
genesis_register_sidebar( array(
'id' => 'home-middle',
'name' => __( 'Home - Middle', 'fabric8ted' ),
'description' => __( 'This is the middle section of the home page.', 'fabric8ted' ),
) );
genesis_register_sidebar( array(
'id' => 'home-twitter',
'name' => __( 'Home - Twitter', 'fabric8ted' ),
'description' => __( 'This is the twitter feed section on the home page.', 'fabric8ted' ),
) );
genesis_register_sidebar( array(
'id' => 'home-bottom',
'name' => __( 'Home - Bottom', 'fabric8ted' ),
'description' => __( 'This is the bottom section of the home page.', 'fabric8ted' ),
) );/** Customize the credits */add_filter( 'genesis_footer_creds_text', 'custom_footer_creds_text' );
function custom_footer_creds_text() {
echo '<div class="creds"><p>';
echo 'Copyright © ';
echo date('Y');
echo ' | Allie Chynna | Designed by 21st Street Designs | Login';
echo '</p></div>';
}
July 12, 2013 at 5:53 pm #50479alliechynnaMemberI've tried adding this but it comes up with an error every time, where about's in the code do I need to add it.
/** Add after post widgeted area */
add_action( 'genesis_before_loop', 'child_after_post_area', 9 );
function child_after_post_area() {
if(is_home()) {
echo '
'; dynamic_sidebar( 'after post area' ); echo '
';
} -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.