Simple .php help

by 14 replies
16
Hi all. I'm working on a blog and need some what I think is simple .php help. (I just don't know php!)

I have some text that goes over the slides that I would like to change just to static text. There are 5 slides, so I would like 5 different text options. Here is what the code looks like currently:

<?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
});
}
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 really don't care that slides are pointing to articles, I have the images I want installed. I just need to change the overtext...to not be dependent on the articles, just to imput some text into the code.

Thanks for your help! :p
#website design #php #simple
  • Try this:

    PHP Code:
    <?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
    });
    }
    window.addEvent('domready', startGallery);
    </script>
    <div class="fullbox_excerpt">
    <div class="fullbox_content">
    <div class="smooth_gallery">
    <div id="myGallery">

    <!--Slide One-->
    <div class="imageElement">
    <h3>Heading text</h3>
    <p>Slide text here</p>
    </div>
    <!--/Slide One-->
    <!--Slide Two-->
    <div class="imageElement">
    <h3>Heading text</h3>
    <p>Slide text here</p>
    </div>
    <!--/Slide Two-->
    <!--Slide Three-->
    <div class="imageElement">
    <h3>Heading text</h3>
    <p>Slide text here</p>
    </div>
    <!--/Slide Three-->
    <!--Slide Four-->
    <div class="imageElement">
    <h3>Heading text</h3>
    <p>Slide text here</p>
    </div>
    <!--/Slide Four-->
    <!--Slide Five-->
    <div class="imageElement">
    <h3>Heading text</h3>
    <p>Slide text here</p>
    </div>
    <!--/Slide Five-->

    </div>
    </div>
    </div>
    </div>
    <?php ?>
    I haven't tested it so it might be wrong, but give it a whirl and see how you go.
    • [1] reply
    • no, that didn't work. It removed all of my images and replaced it with "Slide 4 - heading text - slide text here..." etc
      • [1] reply
  • Show me your site please.
  • Okay, I guess that wasn't very clear. I want to keep the images as I've already updated the slides with the proper images. I just need to make the text static as in I want to code my own text in for each of the 5 slides.
    • [1] reply
    • TPW, I will try what you suggested with the img src.

      Thanks
      • [1] reply
  • show me your site?
  • BaMoon, it won't let me post a link, but the name of my site is stock trading best. Yes, it's a dot com.
  • Okay, to recap, I have a wordpress blog that has a slide show on the home page. I have the images that I want working now, I just need to put my own text into the php to display on the five slides. (so that's 5 different text sections). I have pasted the code in the very first entry of this thread. If anyone can tell me how to put my own text on each of the 5 slides, and NOT have the general text it is placing, that would be great!
  • Hi,

    What is the name of your theme your using? most slide show theme has a feature you just add the text in the post and choose the category you want and wala its posted on your main site in the feature section.
  • Hi SDStudio. I don't want it to use text from the post. I want to put my own text over the images so it stays static when I update posts and such.
  • Anyone? Please? I just need the code to put in my own text over the images instead of the <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>

    I appreciate anyone's help.
    • [1] reply
    • No its not Working. Ca know whats the problem with it and can you check it once

Next Topics on Trending Feed

  • 16

    Hi all. I'm working on a blog and need some what I think is simple .php help. (I just don't know php!) I have some text that goes over the slides that I would like to change just to static text. There are 5 slides, so I would like 5 different text options. Here is what the code looks like currently: