Jump to content

Recommended Posts

I'm still working on my new Wordpress site. It's almost ready to launch, but I've run into a couple of problems which I just can't explain logically. Any help would be greatly appreciated.

 

The website is at test.nowillnoskill.net

 

Here they are:

 

Recent posts stopped working

 

I want to return the 2 newest posts when in single post mode, but exclude the current post. And I did it. The problem is, it just stopped working. It didn't change the code and it stopped on the server as well as on my localhost.

 

Here's the code:

 

<section id='recent_posts'>

            <header class='recent_header'>
                Recent posts
            </header>

            <?php 
                $id = $post->ID;
                $recent_posts = wp_get_recent_posts("numberposts=2&exclude=$id");

                foreach( $recent_posts as $recent ) { ?>                        

                    <article class='single_recent'>
                        <header>
                            <a href="<?php echo get_permalink($recent["ID"]); ?>"><?php echo $recent["post_title"]; ?></a>
                        </header>
                        <p>
                            <?php echo get_excerpt_by_id($recent["ID"]); ?>
                        </p>
                    </article>

            <?php } ?>

        </section>

 

See this question on SO

 

the_author() empty only on index.php when not logged in

 

I have two different ways to load posts. One is in index.php and another one is in loop.php. The first one loads the first 4 posts, the latter loads more posts when scrolling down or clicking on the "load more" button. Both are inside the loop.

 

The code is THE SAME, but index.php doesn't show anything when I call the_author, when a user is not logged in. When I'm logged in, I see the author name all the time and when logged out, I only see the name on newly loaded posts.

 

See this question on SO

 

have_comments() returns false [with comments_template()]

 

I just copied the code for the comments template and the 3 functions from this tutorial and it doesn't work.

 

I found a solution that says I should call the template with comments_template() instead of the general include method and that is how I do it. It still doesn't show a single comment, even though get_comments_number() returns 2 and I see the comments in the dashboard.

 

See this question on SO

 

Link to comment
https://forums.phpfreaks.com/topic/267114-wordpress-strange-behaviour/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.