Related posts by category not working right
Related posts by category not working right
Related posts by category not working right
<?php $curauth = (isset($_GET[‘author_name’])) ? get_user_by(‘slug’, $author_name) : get_userdata(intval($author)); ?> <?php if ( have_posts() ) ?> <h2>Posts by <?php echo $curauth->nickname; ?>:</h2> <ul> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <li> <a href=”https://wordpress.stackexchange.com/questions/106902/<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link: <?php the_title(); ?>”> <?php the_title(); ?></a>, <?php the_time(‘d M Y’); ?> … Read more
You need to pass an array to WP_Query like this then after you’ve ended the query use this to reset the query data. <?php wp_reset_query(); ?> example of standard query using WP_Query $arg = array( ‘posts_per_page’ => 20 ); $query = new WP_Query($args) //start to loop your things here <?php if ($query->have_posts()) : ?> <?php … Read more
I use a similar method to the following in a plugin of mine: function wpse107488_urls_to_links( $string ) { /* make sure there is an http:// on all URLs */ $string = preg_replace( “/([^\w\/])(www\.[a-z0-9\-]+\.[a-z0-9\-]+)/i”, “$1http://$2”, $string ); /* create links */ $string = preg_replace( “/([\w]+:\/\/[\w-?&;%#~=\.\/\@]+[\w\/])/i”, “<a target=\”_blank\” title=\”” . __( ‘Visit Site’, ‘your-textdomain’ ) . “\” … Read more
Using ajax on editing a category edit page?
So $img->post_excerpt is your content. It is the attachment’s caption field. You must change the images’ captions attached to the post with the id 54 in order to see any changes , if I understood the question right. ADD: Also attach the images to the post.
Getting all the images from the post, and adding them to the top of the post is relatively easy. You can do something like this: (Note, this is just a code example. I’m not 100% what you are looking for. Hopefully this is enough to get you started.) function getImagesInThisPost() { global $post, $posts; //find … Read more
Ended up with using this code: <?php query_posts(‘category_name=Menucard’); ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div class=”span4 post move pull-left”> <?php //echo post here the_content(); ?> </div> <!– close .post div –> <?php $counter++; if ($counter % 3 == 0) { echo ‘<div style=”clear:both;”></div>’; } ?>
So, I think I’m fairly certain that I’ve narrowed this problem down enough to post a solution. We had this issue crop up on another site. This new site, however, was hosted on a server that has a large number of other websites hosted on it (all ours). The important part of the causal situation … Read more
If I understand correctly you want to display all month of June on one page? This would require overiding the global $per_page setting it to a high number and also you would need to filter pre_get_posts and adjust the SQL query string to return results by date. The post you linked has the answer. Perhaps … Read more