14 replies
  • WEB DESIGN
  • |
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
#php #simple
  • Profile picture of the author Kezz
    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.
    {{ DiscussionBoard.errors[4157320].message }}
    • Profile picture of the author TXdragonfly
      no, that didn't work. It removed all of my images and replaced it with "Slide 4 - heading text - slide text here..." etc
      {{ DiscussionBoard.errors[4157374].message }}
      • Profile picture of the author tpw
        Originally Posted by Aspyer View Post

        no, that didn't work. It removed all of my images and replaced it with "Slide 4 - heading text - slide text here..." etc

        Are you wanting images AND text, or just text?

        In Kezz's solution, she is trying to help you replace the images with text, and you have to edit the code to get your text in there.



        p.s. You can take her code and include the <img src=""> in the html of the slides as indicated in her code.
        Signature
        Bill Platt, Oklahoma USA, PlattPublishing.com
        Publish Coloring Books for Profit (WSOTD 7-30-2015)
        {{ DiscussionBoard.errors[4158241].message }}
  • Profile picture of the author wfcheapseo
    Show me your site please.
    {{ DiscussionBoard.errors[4158100].message }}
  • Profile picture of the author TXdragonfly
    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.
    {{ DiscussionBoard.errors[4161872].message }}
  • Profile picture of the author BaMoon
    show me your site?
    {{ DiscussionBoard.errors[4164705].message }}
  • Profile picture of the author TXdragonfly
    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.
    {{ DiscussionBoard.errors[4164777].message }}
  • Profile picture of the author TXdragonfly
    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!
    {{ DiscussionBoard.errors[4181025].message }}
  • Profile picture of the author SDStudio
    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.
    {{ DiscussionBoard.errors[4181101].message }}
  • Profile picture of the author TXdragonfly
    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.
    {{ DiscussionBoard.errors[4181340].message }}
  • Profile picture of the author TXdragonfly
    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.
    {{ DiscussionBoard.errors[4187444].message }}
    • Profile picture of the author imdprince
      No its not Working. Ca know whats the problem with it and can you check it once
      {{ DiscussionBoard.errors[4188823].message }}

Trending Topics