WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Slideshowpro & WordPress (2 posts)

  1. awx2d
    Member
    Posted 6 years ago #

    Hi I am using the code developed by theundersigned to build the xml doc for a number of slideshow pro gallerys, the script is below, I want to pull out a custom field from each post to be used as the gallery image, any help or advise on this would be greatly appreciated!

    <?php
    require('./wp-config.php');
    header('Content-type: text/xml; charset=utf-8'); 
    
    function ssp_fetch_images($postid, $size) {
        global $wpdb;
        return $wpdb->get_results("SELECT guid, post_title, post_content FROM $wpdb->posts WHERE post_parent = $postid AND post_mime_type = 'image/jpeg'");
    } 
    
    if(isset($_GET['cat'])) {
    $cat = $_GET['cat'];
    $query = "cat=$cat&showposts=1000";
    } else {
    $query = "showposts=1000";
    } ?>
    <gallery>
        <?php $gallery = new WP_Query($query);
        while ($gallery->have_posts()) : $gallery->the_post(); ?>
        <album title="<?php echo htmlspecialchars($post->post_title); ?>" description="<?php echo htmlspecialchars($post->post_content); ?>">
            <?php $images = ssp_fetch_images($post->ID);
            foreach($images as $image) { ?>
            <img src="<?php echo $image->guid; ?>" tn="<?php echo str_replace(".jpg", ".thumbnail.jpg", $image->guid); ?>" title="<?php echo htmlspecialchars($image->post_title); ?>" caption="<?php echo htmlspecialchars($image->post_content); ?>" />
            <?php } ?>
        </album>
        <?php endwhile; ?>
    </gallery>
  2. awx2d
    Member
    Posted 6 years ago #

    Just to clarify as no replies seem to be forthcoming .. while the title specifies SSP this is more custom scripting for pulling specific information from a post in order to make an XML file.

    I have tried the get_post_meta function but I'm either not configuring it correctly or it wont work here, any help would be greatly appreciated

Topic Closed

This topic has been closed to new replies.

About this Topic