WordPress.org

Ready to get started?Download WordPress

Forums

Rotating Posts
found a way to get the read me to work (2 posts)

  1. CwoTani
    Member
    Posted 2 years ago #

    Alot of you are trying to figure out how to get this rotating post to show the "read me" option like it shows in the demo. Just to let you know, the code for this is in the php file but it is not working. I sat here for about 4 hours trying to get it to work. In short, just follow these steps:

    Step 1)Make sure your in the rotating posts.php file
    Step 2) Where you see the line code "load_plugin_textdomain...." add this line of code at the bottom:
    $rp_read_more = ("true" == get_option(RP_OPTION_READ_MORE_DEFAULT));

    This section of the load plugin code should look like this after you make the changes:

    load_plugin_textdomain("rotating-posts", str_replace(ABSPATH, "", dirname(__FILE__) . "/lang") , dirname(plugin_basename(__FILE__)) . "/lang");
    
    	$rp_number_posts			= get_option(RP_OPTION_NUMBER_POSTS);
    	$rp_use_this_category		= get_option(RP_OPTION_USE_THIS_CATEGORY);
    	$rp_timer_sec				= get_option(RP_OPTION_TIMER_SEC);
    	$rp_display_thumbnails		= ("true" == get_option(RP_OPTION_THUMBNAILS));
    	$rp_display_title			= ("true" == get_option(RP_OPTION_TITLE));
    	$rp_display_arrows			= ("true" == get_option(RP_OPTION_ARROWS));
    	$rp_display_date_time		= ("true" == get_option(RP_OPTION_DATE_TIME));
    	$rp_display_author			= ("true" == get_option(RP_OPTION_AUTHOR));
    	$rp_display_categories		= ("true" == get_option(RP_OPTION_CATEGORIES));
    	$rp_display_comments		= ("true" == get_option(RP_OPTION_COMMENTS));
    	$rp_custom_content			= ("true" == get_option(RP_OPTION_CUSTOM_CONTENT));
    	$rp_left					= get_option(RP_OPTION_LEFT);
    	$rp_right					= get_option(RP_OPTION_RIGHT);
    	$rp_pause_normal			= get_option(RP_OPTION_PAUSE_NORMAL);
    	$rp_pause_pressed			= get_option(RP_OPTION_PAUSE_PRESSED);
    	<strong>$rp_read_more			= ("true" == get_option(RP_OPTION_READ_MORE_DEFAULT));</strong>

    Step 3)Scroll further down to where you see the if statement:

    if ($rp_WPQuery->have_posts())
    	{
    		for ($count = 0; $count < $rp_number_posts; $count++)
    		{
    			$rp_WPQuery->the_post();
    
    			global $more;
    			$more = false;

    Change to word false to 0 as in the number zero.

    Step 4) Inside of this if statement there is an else statement. Add the end of the else add this line of code:

    $postReadmore = get_option(RP_OPTION_READ_MORE_DEFAULT);

    The else statement should now look like this:

    else
    			{
    				$postStyle = "display:none;";
    			}
    			$postPermalink = get_permalink();
    			$postTitle = get_the_title();
    			$postTime = get_the_time(get_option(RP_OPTION_DATE_TIME_STR));
    			$postAuthor = get_the_author();
    			$postCategory = get_the_category_list(", ");
    			$postComments = get_comments_link();
    			$rp_by_author_text = get_option(RP_OPTION_AUTHOR_PREFIX) . " " . $postAuthor;
    			$rp_posted_in_category_text = sprintf(__("Posted in %s", 'rotating-posts'), $postCategory);
    			$rp_comments_text = __("Comments", 'rotating-posts');
    			<strong>$postReadmore = get_option(RP_OPTION_READ_MORE_DEFAULT);</strong>

    Step 5)As you scroll further down you will see a few things that are being echoed out. Theres an echo for the title, date and so on. Look for the one that is echoing out the postContent. You are going to comment out that echo like so:

    //echo " <div class='rp_post_content'>{$postContent}</div>\n";

    And add this line of code:

    the_content("Read more...");

    Now it should look like this:

    else if ($rp_display_author)
    			{
    				echo "        <div class='rp_post_time_author'><span class='rp_post_author'>{$rp_by_author_text}</span></div>\n";
    			}
    
    			<strong>//echo "       <div class='rp_post_content'>{$postContent}</div>\n";
    				     the_content("Read more...");</strong>

    Step 6)Now go into your post and add the wordpress more tag to where ever you want to cut the article off at. This is the word press more tag:

    <!--more-->

    Step 7) Your done. Some of the above steps may or may not be needed, im pretty sure all I need is step 5 and step 6 for the code to work, but I ended up going through the steps 1 through 4 to try to get this read me to work and wouldnt work at all until I added in step 5. You can go ahead an try just step 5 and 6 to see if it works but I spent so much time trying to figure out why it doesnt work that I really dont feel like going back to cleaning up the code right now. I also found out that the way the creator of this rotating post set up the read more code, it actually works when u add the read more code. The problem is that it doesnt show the word " Read more" when you run the site. Dont believe me? Try it. Before you make any changes to the code just go ahead and add the <!--more--> tag to your post. Make sure that the post and long enough. When you run it you will see that the post is being cut off but it doesnt show the word " read more". I tried to figure out why it was doing this but I pretty much gave up on that and figured out how to get it to work.

    http://wordpress.org/extend/plugins/rotating-posts/

  2. Wennetje1986
    Member
    Posted 1 year ago #

    it can be easer:
    I don't want to show the category so I changed it:

    else if ($rp_display_categories)
    			{
    			 echo "        <div class='rp_post_lees-meer'><h2><a href='{$postPermalink}'>Read more...</a></h2></div>\n";
    /** old code: echo "        <p class='rp_post_metadata'>{$rp_posted_in_category_text}</p>\n";**/
    			}

    Only I have to do is mark the category and read more is visible on every post in the plugin.

    So if you don't use a that mark to show read more automatic
    Good Luck!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic