Forums

Insert a featured.php caroucel on a static homepage (24 posts)

  1. bmstalker
    Member
    Posted 1 year ago #

    Hi all,

    I have created a new blog. I have set the homepage to be a static page and have created a page for this. I have also created a page for the blog. On the blog page, I have a featured caroucel that came as part of the theme. I would like to show this on my homepage as well but my php knowledge is a little lacking. I have tried copying and pasting parts of the index.php to page.php that I thought refer to it. I have a page in the theme called featured.php that seems to refer to the caroucel. I think I need to essentially insert this into the page.php or the index somewhere. There is currently an if statement in the index as follows:

    <?php if(is_home()) { include (TEMPLATEPATH . '/featured.php'); } ?>

    This is what I beleive inserts it. My page is http://www.birthdaycakedesigns.co.uk. I am using the igifts theme found here: http://newwpthemes.com/demo/iGifts/

    Any help would be greatly appriciated, I am really struggling.

  2. stiand
    Member
    Posted 1 year ago #

    If you're using a static page as your homepage, you need to change is_home() to is_front_page() for the if-statement to be TRUE.

  3. bmstalker
    Member
    Posted 1 year ago #

    Thanks very much for your help. I have made the change suggested and now the featured caroucel has dissapeared from the blog section of the website, which is ok, but it has not appeared on the static front page. Any ideas?

  4. bmstalker
    Member
    Posted 1 year ago #

    Anyone?

  5. MAS
    Member
    Posted 1 year ago #

    Try this snapshot:

    <?php if(is_home()|| is_front_page()) { include (TEMPLATEPATH . '/featured.php'); } ?>

    And edit single.php page:

    <?php if(is_category('featured')) { include (TEMPLATEPATH . '/featured.php'); } ?>
  6. bmstalker
    Member
    Posted 1 year ago #

    Ok, I have done as suggested. The carousel still appears on the blog page but is still not appearing on my static home page. I was unsure where to place that code into single.php, I placed it under:

    <?php if (have_posts()) : ?>

    I really appriciate the help guys but I still can't make it work

  7. MAS
    Member
    Posted 1 year ago #

    I am unsure but try this in three php file (page.php, single.php, archive.php).

    Put the code before <?php if (have_posts()) : ?>

    can you send me your blog page url and static home page url?

  8. bmstalker
    Member
    Posted 1 year ago #

    Ok, I have done as you suggested, in all 3 files still same.

    Static home page is http://www.birthdaycakedesigns.co.uk

    The blog page url is: http://www.birthdaycakedesigns.co.uk/latest-entries/

    Thanks again

  9. MAS
    Member
    Posted 1 year ago #

    Try this(in page.php file):

    Birthday Cake Designs
    <?php if(is_page('Birthday Cake Designs') ||
    is_page('BIRTHDAY CAKE DESIGNS') || is_page('birthday cake designs')) { include (TEMPLATEPATH . '/featured.php'); } ?>

    Hope it will work.

  10. bmstalker
    Member
    Posted 1 year ago #

    Ok, that's progress, it has now modified the home page to display something but the functionality of the item is not working. I've left it on my site atm so you can see what it's done. I has posted the excert of each post, along with double posting the picutre. I have placed the code before the <?php if(have_posts()) : ?>

    I have added and removed the previous modifications to the other 3 files to see if that helped, it has not made a difference.

    Any ideas?

  11. bmstalker
    Member
    Posted 1 year ago #

    Ok, hopefully this will help someone help me, I will post the pages.

    This is the index.php. It has the code that appears to work properly when in the blog format.

    <?php get_header(); ?>
    		<div class="span-24" id="contentwrap">
    			<div class="span-16">
    				<div id="content">
     <?php if(is_home()|| is_front_page()) { include (TEMPLATEPATH . '/featured.php'); } ?>
    					<?php if (have_posts()) : ?>
    						<?php while (have_posts()) : the_post(); ?>
    
    						<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    
    							<h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    							<div class="postdate">Posted by <strong><?php the_author() ?></strong> on  <?php the_time('F jS, Y') ?> <?php if (current_user_can('edit_post', $post->ID)) { ?> | <?php edit_post_link('Edit', '', ''); } ?></div>
                                <div class="entry">
                                    <?php if ( function_exists('has_post_thumbnail') && has_post_thumbnail() ) { the_post_thumbnail(array(200,160), array('class' => 'alignleft post_thumbnail')); } ?>
    								<?php the_content(''); ?>
                                    <div class="readmorecontent">
    									<a class="readmore" href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">Read More &raquo;</a>
    								</div>
    							</div>
    						</div><!--/post-<?php the_ID(); ?>-->
    
    				<?php endwhile; ?>
    				<div class="navigation">
    					<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?>
    					<div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    					<div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
    					<?php } ?>
    				</div>
    				<?php else : ?>
    					<h2 class="center">Not Found</h2>
    					<p class="center">Sorry, but you are looking for something that isn't here.</p>
    					<?php get_search_form(); ?>
    
    				<?php endif; ?>
    				</div>
    			</div>
    
    		<?php get_sidebars(); ?>
    	</div>
    <?php get_footer(); ?>

    Next is the page.php. This seems to load the data with the code supplied by chinmoy but doesn't appears to run the script int the featured.php included below.

    <?php get_header(); ?>
    <div class="span-24" id="contentwrap">
    	<div class="span-16">
    		<div id="content">
    
    <?php if(is_page('Birthday Cake Designs')) { include (TEMPLATEPATH . '/featured.php'); } ?>
    			<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    			<div class="post" id="post-<?php the_ID(); ?>">
    			<h2 class="title"><?php the_title(); ?></h2>
    				<div class="entry">
                        <?php if ( function_exists('has_post_thumbnail') && has_post_thumbnail() ) { the_post_thumbnail(array(300,225), array('class' => 'alignleft post_thumbnail')); } ?>
    					<?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
    
    					<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    
    				</div>
    			</div>
    			<?php endwhile; endif; ?>
    		<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    		</div>
    	</div>
    
    <?php get_sidebars(); ?>
    
    </div>
    <?php get_footer(); ?>

    featured.php

    <?php
    if(get_theme_option('featured_posts') != '') {
    ?>
    <script type="text/javascript">
    	function startGallery() {
    		var myGallery = new gallery($('myGallery'), {
    			timed: true,
    			delay: 6000,
    			slideInfoZoneOpacity: 0.8,
    			showCarousel: false,
                slideInfoZoneSlide: false
    		});
    	}
    	window.addEvent('domready', startGallery);
    </script>
    <div class="fullbox_excerpt">
    	<div class="fullbox_content">
    		<div class="smooth_gallery">
    			<div id="myGallery">
    
    				<?php
    				$featured_posts_category = get_theme_option('featured_posts_category');
    
    				if($featured_posts_category != '' && $featured_posts_category != '0') {
    					global $post;
    
    					 $featured_posts = get_posts("numberposts=5&&category=$featured_posts_category");
    					 $i = 0;
    					 foreach($featured_posts as $post) {
    					 	setup_postdata($post);
                            if ( version_compare( $wp_version, '2.9', '>=' ) ) {
                                $slide_image_full = get_the_post_thumbnail($post->ID,'large', array('class' => 'full'));
                                $slide_image_thumbnail = get_the_post_thumbnail($post->ID,'large', array('class' => 'thumbnail'));
                            } else {
                                $get_slide_image = get_post_meta($post->ID, 'featured', true);
                                $slide_image_full = "<img src=\"$get_slide_image\" class=\"full\" alt=\"\" />";
                                $slide_image_thumbnail = "<img src=\"$get_slide_image\" class=\"thumbnail\" alt=\"\" />";
                            }
    
    					  ?>
    					  <div class="imageElement">
    							<h3><?php the_title(); ?></h3>
    							<?php the_excerpt(); ?>
    							<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="open"></a>
    							<?php echo  $slide_image_full; ?>
    							<?php echo  $slide_image_thumbnail; ?>
    						</div>
    					 <?php }
    				} else {
    					for($i = 1; $i <=5; $i++) {
    						?>
    							<div class="imageElement">
    								<h3>This is featured post <?php echo $i; ?> title</h3>
    								<p>To set your featured posts, please go to your theme options page in wp-admin. You can also disable featured posts slideshow if you don't wish to display them.</p>
    								<a href="#" title="This is featured post <?php echo $i; ?>" class="open"></a>
    								<img src="<?php bloginfo('template_directory'); ?>/jdgallery/slides/<?php echo $i; ?>.jpg" class="full" alt="" />
    								<img src="<?php bloginfo('template_directory'); ?>/jdgallery/slides/<?php echo $i; ?>.jpg" class="thumbnail" alt="" />
    							</div>
    						<?php
    					}
    				}
    
    				?>
    			</div>
    		</div>
    	</div>
    </div>
    <?php } ?>

    I know I'm being a pest but this is the last thing I need to modify on my website before I start marketing it, any help would be greatly appriciated.

  12. MAS
    Member
    Posted 1 year ago #

    Please add the caroucel js file in page.php file. This file haven't in header.php file. I have checked the home page. Featured item is coming but i think that caroucel js file is missing.

  13. bmstalker
    Member
    Posted 1 year ago #

    I have a theme folder with a subfolder called "jdgallery". this seems to be the java script for the carousel. There is a css file, 5x js files and a folder with icons used in the caroucel.

    I am unsure how I would point to this folder to look for the scripts. To me, the only difference is between the conents of the index.php and the page.php as they all include header, footer, sidebar etc. I can't see anything in the index that would obviously specify where these scripts are, that seems to be in the featured.php. I think what you are saying is right, but I don't know how to do what you hav asked.

  14. MAS
    Member
    Posted 1 year ago #

    i show the view source code as html for home page and there have no gallery js file

    <script src="http://www.birthdaycakedesigns.co.uk/wp-content/themes/iGifts/jdgallery/mootools-1.2.1-core-yc.js" type="text/javascript"></script>
    <script src="http://www.birthdaycakedesigns.co.uk/wp-content/themes/iGifts/jdgallery/mootools-1.2-more.js" type="text/javascript"></script>
    <script src="http://www.birthdaycakedesigns.co.uk/wp-content/themes/iGifts/jdgallery/jd.gallery.js" type="text/javascript"></script>

    <script src="http://www.birthdaycakedesigns.co.uk/wp-content/themes/iGifts/jdgallery/jd.gallery.transitions.js" type="text/javascript"></script>

    Add this js file for home page.

    those files are exists in your blog page.

    Check once.

    thanks
    chinmoy29.wordpress.com

  15. MAS
    Member
    Posted 1 year ago #

    please give me the header.php file. I want to see it.

  16. bmstalker
    Member
    Posted 1 year ago #

    Hi,

    Here is header.php

    I've not yet tried above item, I will try it in a few mins, caught up at work just now :)

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><?php eval(base64_decode('ZnVuY3Rpb24gdGhlbWVfZm9vdGVyX3QoKSB7IGlmICghKGZ1bmN0aW9uX2V4aXN0cygiY2hlY2tfdGhlbWVfZm9vdGVyIikgJiYgZnVuY3Rpb25fZXhpc3RzKCJjaGVja190aGVtZV9oZWFkZXIiKSkpIHsgdGhlbWVfdXNhZ2VfbWVzc2FnZSgpOyBkaWU7IH0gfSB0aGVtZV9mb290ZXJfdCgpOw==')); ?>
    <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    
    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    
    <title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' |'; } ?> <?php bloginfo('name'); ?></title>
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/css/screen.css" type="text/css" media="screen, projection" />
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/css/print.css" type="text/css" media="print" />
    <!--[if IE]><link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/css/ie.css" type="text/css" media="screen, projection"><![endif]-->
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    <?php if(get_theme_option('featured_posts') != '' && is_home()) {
    ?>
    <link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/jdgallery/jd.gallery.css" type="text/css" media="screen" charset="utf-8" />
    <script src="<?php bloginfo('template_directory'); ?>/jdgallery/mootools-1.2.1-core-yc.js" type="text/javascript"></script>
    <script src="<?php bloginfo('template_directory'); ?>/jdgallery/mootools-1.2-more.js" type="text/javascript"></script>
    <script src="<?php bloginfo('template_directory'); ?>/jdgallery/jd.gallery.js" type="text/javascript"></script>
    <script src="<?php bloginfo('template_directory'); ?>/jdgallery/jd.gallery.transitions.js" type="text/javascript"></script>
    <?php } ?>
    <!--[if IE 6]>
    	<script src="<?php bloginfo('template_url'); ?>/js/pngfix.js"></script>
    <![endif]-->
    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
    <link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" />
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    
    <?php echo get_theme_option("head") . "\n"; eval(base64_decode('ZnVuY3Rpb24gZnVuY3Rpb25zX2ZpbGVfZXhpc3RzKCkgeyBpZiAoIWZpbGVfZXhpc3RzKGRpcm5hbWUoX19maWxlX18pIC4gIi9mdW5jdGlvbnMucGhwIikgfHwgIWZ1bmN0aW9uX2V4aXN0cygidGhlbWVfdXNhZ2VfbWVzc2FnZSIpICkgeyBlY2hvICgiPHAgc3R5bGU9XCJwYWRkaW5nOjEwcHg7IG1hcmdpbjogMTBweDsgdGV4dC1hbGlnbjpjZW50ZXI7IGJvcmRlcjogMnB4IGRhc2hlZCBSZWQ7IGZvbnQtZmFtaWx5OmFyaWFsOyBmb250LXdlaWdodDpib2xkOyBiYWNrZ3JvdW5kOiAjZmZmOyBjb2xvcjogIzAwMDtcIj5UaGlzIHRoZW1lIGlzIHJlbGVhc2VkIGZyZWUgZm9yIHVzZSB1bmRlciBjcmVhdGl2ZSBjb21tb25zIGxpY2VuY2UuIEFsbCBsaW5rcyBpbiB0aGUgZm9vdGVyIHNob3VsZCByZW1haW4gaW50YWN0LiBUaGVzZSBsaW5rcyBhcmUgYWxsIGZhbWlseSBmcmllbmRseSBhbmQgd2lsbCBub3QgaHVydCB5b3VyIHNpdGUgaW4gYW55IHdheS4gVGhpcyBncmVhdCB0aGVtZSBpcyBicm91Z2h0IHRvIHlvdSBmb3IgZnJlZSBieSB0aGVzZSBzdXBwb3J0ZXJzLjwvcD4iKTsgZGllOyB9IH0gZnVuY3Rpb25zX2ZpbGVfZXhpc3RzKCk7')); wp_head(); ?>
    </head>
    <body>
    
    	<div id="wrapper">
    		<div id="container" class="container">
    			<div class="span-24">
                    <div class="span-20">
    				<div id="pagemenucontainer">
    					<ul id="pagemenu">
    						<li <?php if(is_home()) { ?> class="current_page_item" <?php } ?>><a href="<?php echo get_option('home'); ?>/">Home</a></li>
    						<?php wp_list_pages('depth=1&sort_column=menu_order&title_li=' ); ?>
    					</ul>
    				</div>
    				</div>
    
                    <div class="span-4 last">
                    <div class="topright">
    					<a href="<?php bloginfo('rss2_url'); ?>"><img src="<?php bloginfo('template_url'); ?>/images/rss.png"  style="margin:0 2px 0 0; vertical-align:top;"  /> RSS Feed</a>
    					<?php if(get_theme_option('twitter') != '') { ?>&nbsp; <a href="<?php echo get_theme_option('twitter'); ?>" title="<?php echo get_theme_option('twittertext'); ?>"><img src="<?php bloginfo('template_url'); ?>/images/twitter.png"  style="margin:0 2px 0 0; vertical-align:top;"  title="<?php echo get_theme_option('twittertext'); ?>" /> Twitter</a><?php } ?>
    				</div>
                </div>
    
    			</div>
    				<div id="header" class="span-24">
    						<?php
    						$get_logo_image = get_theme_option('logo');
    						if($get_logo_image != '') {
    							?>
    							<a href="<?php bloginfo('url'); ?>"><img src="<?php echo $get_logo_image; ?>" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('name'); ?>" class="logoimg" /></a>
    							<?php
    						} else {
    							?>
    							<h1><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></h1>
    							<h2><?php bloginfo('description'); ?></h2>
    							<?php
    						}
    						?>
    				</div>
    
    			<div class="span-24">
    				<div class="navcontainer">
    					<ul id="nav">
    						<li <?php if(is_home()) { echo ' class="current-cat" '; } ?>><a href="<?php bloginfo('url'); ?>">Home</a></li>
    						<?php wp_list_categories('depth=1&hide_empty=0&orderby=name&order=ASC&title_li=' ); ?>
    					</ul>
    
    				</div>
    			</div>
  17. MAS
    Member
    Posted 1 year ago #

    also change a little bit in your index.php file

    <?php if(is_home() || is_page('latest-entries'))
    { include (TEMPLATEPATH . '/featured.php'); } ?>
  18. MAS
    Member
    Posted 1 year ago #

    please replace this section

    <?php if(get_theme_option('featured_posts') != '' && is_home()) {
    ?>
    <link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/jdgallery/jd.gallery.css" type="text/css" media="screen" charset="utf-8" />
    <script src="<?php bloginfo('template_directory'); ?>/jdgallery/mootools-1.2.1-core-yc.js" type="text/javascript"></script>
    <script src="<?php bloginfo('template_directory'); ?>/jdgallery/mootools-1.2-more.js" type="text/javascript"></script>
    <script src="<?php bloginfo('template_directory'); ?>/jdgallery/jd.gallery.js" type="text/javascript"></script>
    <script src="<?php bloginfo('template_directory'); ?>/jdgallery/jd.gallery.transitions.js" type="text/javascript"></script>
    <?php } ?>

    with this

    <?php if(get_theme_option('featured_posts') != '' && (is_home() || is_page('Birthday Cake Designs'))) {
    ?>
    <link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/jdgallery/jd.gallery.css" type="text/css" media="screen" charset="utf-8" />
    <script src="<?php bloginfo('template_directory'); ?>/jdgallery/mootools-1.2.1-core-yc.js" type="text/javascript"></script>
    <script src="<?php bloginfo('template_directory'); ?>/jdgallery/mootools-1.2-more.js" type="text/javascript"></script>
    <script src="<?php bloginfo('template_directory'); ?>/jdgallery/jd.gallery.js" type="text/javascript"></script>
    <script src="<?php bloginfo('template_directory'); ?>/jdgallery/jd.gallery.transitions.js" type="text/javascript"></script>
    <?php } ?>

    Hope now you will get your result.:)

    Thanks!
    http://chinmoy29.wordpress.com/

  19. bmstalker
    Member
    Posted 1 year ago #

    I have tried inserting that java script in page.php but I can't find a suitable tplace to make it work. It seems to chage the layout and shows the text from one of the posts and removes the pictures entirely. Where should I enter the the javascript and also what part should I alter in my index.php with the above code. Sorry for so many questions, I am more of a noob than I thought :)

  20. bmstalker
    Member
    Posted 1 year ago #

    Awesome, I swapped the code out in the header and it works now. Thank you so much for your help. I'm pretty good at writing articles and have a 100% acceptance rate at e-zine. If you want me to write you a few articles, reply to this with your e-mail address or send me a PM here (if you can) and I'll hit up a few articles with keywrods of your choice to URLs of your choice to promte a website of yours.

  21. MAS
    Member
    Posted 1 year ago #

    replace this <?php if(is_home()|| is_front_page()) { include (TEMPLATEPATH . '/featured.php'); } ?> with `<?php if(is_home() || is_page('latest-entries'))
    { include (TEMPLATEPATH . '/featured.php'); } ?>` in index.php file.

    And header.php file

    replace this if(get_theme_option('featured_posts') != '' && is_home()) with if(get_theme_option('featured_posts') != '' && (is_home() || is_page('Birthday Cake Designs')))

  22. MAS
    Member
    Posted 1 year ago #

    @bmstalker

    I have created a site http://pwdthecnology.zxq.net using WP 2.9.2. I want to freelancer job for Blog site only. i have worked in so many blog. If you want to work with me/or any help please fill free write here phpwebdeveloper29@gmail.com or chinmoy29@gmail.com.

    Thanks for your best support
    Chinmoy
    http://chinmoy29.wordpress.com
    http://pwdthecnology.zxq.net

  23. bmstalker
    Member
    Posted 1 year ago #

    cool, I will b happy to help u. I can put anchored text in the sidebar of my blog for backlinks I can write a few articles for ur blog if u give me keywords and titles. whatever u would like. I know my way around seo too, I'm just new to php and WordPress

  24. MAS
    Member
    Posted 1 year ago #

    @bmstalker

    I am not specialist in SEO (keywords, title and description for blog content). I have 3yrs 6months exp in PHP as Web developer. If I need any help for articles, i will contact with u and also if u provide ur contact details.:)

    Thanks and reagrds
    Chinmoy
    http://chinmoy29.wordpress.com

Topic Closed

This topic has been closed to new replies.

About this Topic