How to Add Read More Code in Theme Function [Wordpress]

Discussion in 'PHP' started by Mahaj, Aug 3, 2009.

  1. #1
    Hi

    From last 2 weeks im trying to add a feature as 250 words of post on page appear and rest of the article access by Read More Links in WORDPRESS

    I have tried Tags and many tutorial but its seems my selected theme is not allowing or has bug in it. Alot of search I have found the following code which need to be add in function.php


    <?php
    
    add_filter( 'the_content_more_link', 'my_more_link', 10, 2 );
    
    function my_more_link( $more_link, $more_link_text ) {
        return str_replace( $more_link_text, 'Continue reading &rarr;', $more_link );
    }
    
    ?>
    Code (markup):

    Taken from


    <?php
    
    /**
    
    * Coded by misbah (ini_misbah@yahoo.com)
    
    */
    
    if ( function_exists('register_sidebar') ) {
    
        register_sidebar(array(
    
            'name' => 'Primary Sidebar',
    
            'before_widget' => '<li id="%1$s" class="widget">',
    
            'after_widget' => '</li>',
    
            'before_title' => '<h4 class="widget-title">',
    
            'after_title' => '</h4>',
    
        ));
    
        register_sidebar(array(
    
            'name' => 'Secondary Sidebar',
    
            'before_widget' => '<li id="%1$s" class="widget">',
    
            'after_widget' => '</li>',
    
            'before_title' => '<h4 class="widget-title">',
    
            'after_title' => '</h4>',
    
        ));
    
    }
    
    //Check for widgets in widget-ready areas http://wordpress.org/support/topic/190184?replies=7#post-808787
    
    //Thanks to Chaos Kaizer http://blog.kaizeku.com/
    
    function is_sidebar_active( $index = 1){
    
        $sidebars    = wp_get_sidebars_widgets();
    
        $key        = (string) 'sidebar-'.$index;
    
        return (isset($sidebars[$key]));
    
    }
    
    include(TEMPLATEPATH.'/includes/template-options.php');
    
    include(TEMPLATEPATH.'/includes/plugins.php');
    
    /*
    
    add_action('widgets_init', 'remove_default_widgets', 0);
    
    function remove_default_widgets() {
    
        if (function_exists('unregister_sidebar_widget')) {
    
            unregister_sidebar_widget('Search');
    
        }
    
    }
    
    include(TEMPLATEPATH.'/includes/widgets.php');
    
    /**/
    
    Code (markup):

    If you have any suggestion then please give me thanks
     
    Mahaj, Aug 3, 2009 IP