WordPress.org

Support

Support » Plugins and Hacks » WP Rotator » [Plugin: WP Rotator] Examples of function markup

[Plugin: WP Rotator] Examples of function markup

Viewing 1 replies (of 1 total)
  • I added the click-through link to the titles via adding the code below to my functions.php file:

    function custom_rotator_featured_cell_markup($result) {
        global $post, $animate_style, $first;
        $clickthrough_url = esc_attr(get_post_meta($post->ID, 'wp_rotator_url', true));
        $show_info = esc_attr(get_post_meta($post->ID, 'wp_rotator_show_info', true));
        /* Backwards compatible with old version, where we didn't prefix the field */
        if (empty($clickthrough_url)) { $clickthrough_url = esc_attr(get_post_meta($post->ID,'url',true)); }
        if (empty($show_info)) { $show_info = esc_attr(get_post_meta($post->ID,'show_info',true)); }
        /* */
        if (!isset($clickthrough_url)) {
          $clickthrough_url = get_permalink($post->ID);
        }
        $result .= '<li class="featured-cell"';
            if ($animate_style == 'fade') {
              if ($first) {
                $first = false;
              }
              else {
                $result .= 'style="display:none;"';
              }
            }
        $result .= '>';
        $result .= '<a href="' . $clickthrough_url . '">';
        $image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'wp_rotator' );
        global $bsd_pane_height, $bsd_pane_width;
    if ($image[1] == $bsd_pane_height && $image[2] == $bsd_pane_width)
    $result .= get_the_post_thumbnail( $post->ID, 'wp_rotator' );
    else $result .= ' <img width="' . $bsd_pane_width . '" height="' . $bsd_pane_height . '" src="' . $image[0] . '" />';
    
        $result .= '</a>';
    
        if ($show_info == true):
          $result .= ' <div class="info">';
          $result .= '<a href="' . $clickthrough_url . '"> <!-- added link to title -->';
          $result .= ' <h1>' . get_the_title() .'</h1>';
    
          $result .= '</a><!-- closed link to title  --> ';
    
          if (get_the_excerpt()) $result .= ' <p>' . get_the_excerpt() . '</p>';
          $result .= ' </div>';
        endif;
    
        $result .= '</li><!-- featured-cell -->';
        return $result;
    }
    remove_filter('wp_rotator_featured_cell_markup','wp_rotator_featured_cell_markup');
    add_filter('wp_rotator_featured_cell_markup','custom_rotator_featured_cell_markup');
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: WP Rotator] Examples of function markup’ is closed to new replies.
Skip to toolbar