• Hello,

    Thanks for your usefull widget
    I have made an upgrade to be able to templatize the output
    here the changes I have made in rp-news-ticker-front.php
    in the function display_frontend

    /**
             * Widget Output Begins
             *----------------------------------------------------*/
            // use a version of the widget template from the theme if it exists
            // otherwise, use the default widget template from the plugin folder
            $fpw_template = locate_template( 'rp_news_ticker_template/rpnt_default.php', false, true );
    
            foreach($myposts as $post){
                setup_postdata($post);
                if( $fpw_template ) {
                   require( $fpw_template );
                } else {
                   require( plugin_dir_path( __FILE__ ) . 'rp_news_ticker_template/rpnt_default.php' );
                }
                $in_categories[] = $result;
            }
            $alldata = array();

    and here you actual template in the directory of your plugin, file rp_news_ticker_template/rpnt_default.php

    <?php
    $result = sprintf('<li><span>%s</span><a href="%s">%s</a></li>',
        apply_filters('the_time', get_the_time($options['date_format']), $options['date_format']),
            apply_filters('the_permalink', get_permalink()), stripslashes(the_title('', '', false))
    );

    here my template in my theme folder, file rp_news_ticker_template/rpnt_default.php

    <?php
    $result = sprintf('<li>%s</li>',
            stripslashes(the_title('', '', false))
    );

    thanks again
    Fran?ois Chastanet

    https://www.ads-software.com/plugins/rp-news-ticker/

  • The topic ‘Feature request: template’ is closed to new replies.