Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Thanks to Author for this plugin. But There is no option to display subtitle. There is only 2 options - Title and excerpt. Help me change excerpt to subtitle. I use this function to display subtitles in posts : <?php if (function_exists('the_subtitle')){ the_subtitle(); }?> This is file of fronpage config: I marked the neccesarry lines.

<?php
  /*
 Plugin Name: Frontpage-Slideshow
 Plugin URI: http://wordpress.org/extend/plugins/frontpage-slideshow/
 Description: Frontpage Slideshow provides a slide show like you can see on <a      href="http://linux.com">linux.com</a> or <a href="http://modulaweb.fr/">modulaweb.fr</a>      front page. <a href="options-general.php?page=frontpage-slideshow">Configuration Page</a>
 Version: 0.9.9.3.8
 Author: Jean-François VIAL
 Author URI: http://www.modulaweb.fr/
 Text Domain: frontpage-slideshow
 */
 /*  Copyright 2009 Jean-François VIAL  (email : jeff@modulaweb.fr)

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
   define ('FRONTPAGE_SLIDESHOW_VERSION', '0.9.9.3.8');
   $fs_already_displayed = false; // the slideshow dont have been displayed yet

 // integrates the template file
 $template = 'default';
 $options = frontpageSlideshow_get_options();
 if (isset($options['values']['fs_template'])) {
if (is_file (dirname(__FILE__).'/templates/'.$options['values']['fs_template'].'          /template.php'))
    $template = $options['values']['fs_template'];
 }
 include (dirname(__FILE__).'/templates/'.$template.'/template.php');


    function frontpageSlideshow($content,$force_display=false,$options=array()) {
global $fs_already_displayed,$fs_last;

if ($fs_already_displayed) return false;

if (!count($options)) $options = frontpageSlideshow_get_options();
if (!$options['values']['fs_is_activated'] && !$force_display) return $content;
$fscategories = implode(',',$options['values']['fs_cats']);

if ((!is_feed() && is_front_page() && $options['values']['fs_insert']!='shortcode') || $force_display) { // the slideshow is only displayed on frontpage
    $fs_already_displayed = true;
    $fsposts = get_posts('category='.$fscategories.'&orderby='.$options['values']['fs_orderby'].'&numberposts='.$options['values']['fs_slides'].'&order='.$options['values']['fs_order']);
    $fsentries = array();
    foreach ($fsposts as $fspost) {
        // format informations
        $title = get_post_meta($fspost->ID,'fs-title',true);
        if ($title == '') $title = $fspost->post_title;
        $comment = get_post_meta($fspost->ID,'fs-comment',true);
        if ($comment == '' && $options['values']['fs_default_comment_to_excerpt'])
            $comment = $fspost->post_excerpt;
        $buttoncomment = get_post_meta($fspost->ID,'fs-button-comment',true);
        $link='';
        // if the option is on, uses the post permalink as slide link
        ($options['values']['fs_default_link_to_page_link'] && get_post_meta($fspost->ID,'fs-link',true) == '') ? $link = get_permalink($fspost->ID) : $link = get_post_meta($fspost->ID,'fs-link',true);
        $image = get_post_meta($fspost->ID,'fs-picture',true);
        if ($image == '') { // if no image : use the first image on the post
            if (function_exists('has_post_thumbnail')) {
                if (has_post_thumbnail($fspost->ID)) {
                    $image = wp_get_attachment_image_src(get_post_thumbnail_id($fspost->ID),'large');
                    $image = $image[0];
                }
            }
            if ($image=='') {
                if (preg_match('/<img[^>]*src="([^"]*)"/i',$fspost->post_content,$matches)) {
                    $image = $matches[1];
                } else {
                    (is_ssl()) ? $url = str_replace('http://','https://',get_bloginfo('url')) : $url = str_replace('https://','http://',get_bloginfo('url'));
                    $image = $url.'/wp-content/plugins/frontpage-slideshow/images/one_transparent_pixel.gif';
                }
            }
        }

        // handles https for the link
        (!is_ssl()) ? $link = str_replace('https://','http://',$link) : $link = str_replace('http://','https://',$link);
        // handles https for image
        (!is_ssl()) ? $image = str_replace('https://','http://',$image) : $image = str_replace('http://','https://',$image);

        // add a temporal variable to the image url to avoid cache


        // put infos into an array
        $fsentries[] = array('title' => $title.'&nbsp;', 'image' => $image, 'comment' => $comment.'&nbsp;', 'button-comment' => $buttoncomment.'&nbsp;', 'link' => $link, 'post_id' => $fspost->ID);
    }
    // construct the slider
    $fscontent = '';
    $fslast = count($fsentries) -1;
    if (count($fsentries))
        $fscontent = frontpageSlideshow_TPL($fsentries);
    $header = frontpageSlideshow_header(true,$options);
    return "\n<!-- Frontpage Slideshow begin -->\n{$fscontent}\n{$header}\n<!-- Frontpage Slideshow end -->\n{$content}";

} else {
    return $content;
}
  }

 function frontpageSlideshow_init() {
// loads the needed frameworks to load as a safe way
wp_register_script('jquery-ui-effects',WP_PLUGIN_URL .'/frontpage-slideshow/js/jquery-ui-effects.js', array('jquery-ui-core'));
wp_enqueue_script('jquery-ui-effects');
  }
  function frontpageSlideshow_admin_enqueue_scripts() {
// loads the needed frameworks to load as a safe way into admin page
wp_enqueue_script('jquery-ui-draggable');
wp_enqueue_script('jquery-ui-droppable');
wp_enqueue_script('jquery-ui-selectable');
wp_enqueue_script('jquery-ui-sortable');
  }

  function frontpageSlideshow_header($force_display=false,$options=array()) {
    if (!count($options)) $options = frontpageSlideshow_get_options();
    if (!$options['values']['fs_is_activated'] && !$force_display) return;
    $fscategories = implode(',',$options['values']['fs_cats']);
    $fsposts = get_posts('category='.$fscategories.'&orderby=ID&numberposts='.$options['values']['fs_slides']);
    $fslast = count($fsposts) - 1;

    frontpageSlideshow_JS($options,$fslast);
    frontpageSlideshow_CSS($options,$fslast+1);
    return '
  <script type="text/javascript">
  // <![CDATA[
  jQuery(\'head\').append(\'<!--[if IE]><style type="text/css">#fs-text { filter:       alpha(opacity='.str_replace('%','',$options['values']['fs_text_opacity']).'); }</style><![endif]--><style type="text/css">'.str_replace("\n",'       ',str_replace("\t",'',FS_CSS)).'</style>\');
  '.FS_JS.'
  // ]] >
  </script>';
        }

   function frontpageSlideshow_JS_effect($effect,$inout='out') {
$options = frontpageSlideshow_get_options();
if ($effect == 'random') {
    $transitions = array('fade', 'shrink', 'dropout', 'jumpup',     'explode',      'clip', 'dropleft', 'dropright', 'slideleft', 'slideright', 'fold', 'puff');
    $effect = $transitions[rand(0,count($transitions)-1)];
}
$inout = ucfirst(strtolower($inout));
$callback = '';
$duration = $options['values']['fs_transition_on_duration'];
if ($inout == 'Out') {
    $callback = ', fsChangeSlide2';
    $duration = $options['values']['fs_transition_duration'];
}
switch ($effect) {
    case 'scale':
    case 'shrink':
        return 'jQuery("#fs-slide").toggle("scale", {}, ' . $duration .      $callback.');';
    case 'dropout':
    case 'drodown':
        return 'jQuery("#fs-slide").toggle("drop", {direction: "down"}, ' . $duration . $callback.');';
    case 'jumpup':
    case 'dropup':
        return 'jQuery("#fs-slide").toggle("drop", {direction: "up"}, ' . $duration . $callback.');';
    case 'explode':
        return 'jQuery("#fs-slide").toggle("explode", {pieces: 32}, ' . $duration . $callback.');';
    case 'clip':
        return 'jQuery("#fs-slide").toggle("clip", {direction: "vertical"}, ' . $duration . $callback.');';
    case 'dropleft':
        return 'jQuery("#fs-slide").toggle("drop", {direction: "left"}, ' . $duration . $callback.');';
    case 'dropright':
        return 'jQuery("#fs-slide").toggle("drop", {direction: "right"}, ' . $duration . $callback.');';
    case 'slideleft':
        return 'jQuery("#fs-slide").toggle("slide", {direction: "left"}, ' . $duration . $callback.');';
    case 'slideright':
        return 'jQuery("#fs-slide").toggle("drop", {direction: "right"}, ' . $duration . $callback.');';
    case 'fold':
        return 'jQuery("#fs-slide").toggle("fold", {}, ' . $duration . $callback.');';
    case 'puff':
        return 'jQuery("#fs-slide").toggle("puff", {}, ' . $duration . $callback.');';
    case 'fadeout':
    case 'fade':
    default:
        return 'jQuery("#fs-slide").fade'.$inout.'(' . $duration . $callback.');';
}
  }

   function frontpageSlideshow_dedicated_shortcode ($attributes=array(), $content=null)       {
global $fs_already_displayed;

$options = frontpageSlideshow_get_options(); // get default or tweaked options

// dont do anything if
//  - the slideshow has already been displayed
//  - the slideshow has not been activated
//  - the shortcode option is not activated
// parse the other eventually nested shortcodes and display the enventualy specified content
if ($fs_already_displayed || !$options['values']['fs_is_activated'] || $options['values']['fs_insert']!='shortcode') return do_shortcode($content);

$options['values'] = shortcode_atts($options['values'], $attributes);
if (is_array($attributes)) {
    if (array_key_exists('fs_cats',$attributes))
        $options['values']['fs_cats'] = explode(',',$attributes['fs_cats']);
      }
$force_display_if_shortcode = true;
$force_display_if_shortcode = true;
//frontpageSlideshow_header(true,$options);
return frontpageSlideshow('',true,$options);
  }

  class frontpageSlideshow_Widget extends WP_Widget {

function frontpageSlideshow_Widget() {
    $widget_ops = array('classname' => 'widget_text', 'description' =>      __('Arbitrary text or HTML'));
    $control_ops = array('width' => 400, 'height' => 350);
    $this->WP_Widget('text', __('Text'), $widget_ops, $control_ops);
}

function widget( $args, $instance ) {
    extract($args);
    $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']);
    $text = apply_filters( 'widget_text', $instance['text'] );
    echo $before_widget;
    if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?>
        <div class="textwidget"><?php echo $instance['filter'] ? wpautop(do_shortcode($text)) : do_shortcode($text); ?></div>
    <?php
    echo $after_widget;
}

function update( $new_instance, $old_instance ) {
    $instance = $old_instance;
    $instance['title'] = strip_tags($new_instance['title']);
    if ( current_user_can('unfiltered_html') )
        $instance['text'] =  $new_instance['text'];
    else
        $instance['text'] = wp_filter_post_kses( $new_instance['text'] );
    $instance['filter'] = isset($new_instance['filter']);
    return $instance;
}

    function form( $instance ) {
    $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text'        => '' ) );
    $title = strip_tags($instance['title']);
    $text = format_to_edit($instance['text']);
         ?>
                <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php       _e('Title:'); ?></label>
    <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"        name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php        echo esc_attr($title); ?>" /></p>

    <textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea>

    <p><input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked($instance['filter']); ?> />&nbsp;<label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs.'); ?></label></p>

Some of This lines must be changed:

            $comment = get_post_meta($fspost->ID,'fs-comment',true);
        if ($comment == '' && $options['values']['fs_default_comment_to_excerpt'])
            $comment = $fspost->post_excerpt;
        $buttoncomment = get_post_meta($fspost->ID,'fs-button-comment',true);
        $link='';
share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

Subtitles aren't standard in wordpress so it's hard to know where to find yours.

This code needs to be placed in the frontpageSlideShow function.

Below where it says //format informations add:

$subtitle = //wherever your post subtitles can be found, probably in a custom //meta

Then, you need to add your subtitle to the $fscontent variable. It is difficult to know how the plugin handles certain data, but you need to either append it on to the end of $fscontent or add it into the $fsentries array which goes into $fscontent.

Hopefully this gets you on the right track.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.