<?php
get_header(); // Loads the header.php template
if (have_posts()) : ?>
<div id="blog-wrap" class="blog-wrap-wide blog-isotope clearfix">
<?php
// Loop through each post
while (have_posts()) : the_post();
get_template_part( 'content', get_post_format() );
endwhile;
?>
</div><!-- /post -->
<?php
wpex_pagination(); // Paginate your posts
endif;
get_footer(); //get template footer ?>
]]>Here is the issue …. I run a multisite that will eventually have ‘Curators’, and ‘Pro’ sites. This is all run with prosites plugin. I would like to pull the latest ten sticky posts from the curator sites and display in a slider. I then would like the other ‘sticky’ post to still be available to fill in the front page grid.
I have the code working to pull the info from the proper prosite level:
<?php
global $wpdb;
$table = $wpdb->prefix . 'blogs';
$table2 = $wpdb->prefix . 'pro_sites';
// $blogs = $wpdb->get_results(("SELECT * FROM $table WHERE spam = '0' AND deleted = '0' and archived = '0' and public='1'"));
// $blogs = $wpdb->get_results("SELECT * FROM $table WHERE spam = '0' AND deleted = '0' and archived = '0' and public='1' and blog_id IN(10,11,12,13)");
$blogs = $wpdb->get_results("SELECT *FROM tv_blogs LEFT JOIN tv_pro_sites ON tv_blogs.blog_id = tv_pro_sites.blog_ID
WHERE tv_pro_sites.level = '4'");
if(!empty($blogs)){ ?>
<section id="slider">
<ul class="slides">
<?php
foreach($blogs as $blog){
switch_to_blog($blog->blog_id);
$details = get_blog_details($blog->blog_id);
$args1 = array(
'posts_per_page' => 1,
'orderby' => 'post_date',
'post_status' => 'publish',
'post__in' => get_option( 'sticky_posts' ),
'ignore_sticky_posts' => 1
);
$slider = new WP_Query( $args1 );
?>
<?php while( $slider->have_posts() ) : $slider->the_post(); ?>
<li>
<article <?php post_class(); ?>>
<div class="entry-container">
<header class="entry-header">
<h2 class="entry-title"><a>" title="<?php the_title_attribute(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<aside class="entry-meta">
<?php the_time( get_option( 'date_format' ) ); ?> |
<?php _e( 'Filed under', 'esplanade' ); ?>: <?php the_category( ', ' ) ?>
<?php edit_post_link( __( 'Edit', 'esplanade' ), ' | ', '' ); ?>
</aside><!-- .entry-meta -->
</header><!-- .entry-header -->
<div class="entry-summary">
<?php if( has_post_format( 'audio' ) ) : ?>
<?php esplanade_post_audio(); ?>
<?php endif; ?>
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<div class="clear"></div>
</div><!-- .entry-container -->
<?php if( has_post_format( 'video' ) ) : ?>
<?php esplanade_post_video(); ?>
<?php elseif( has_post_thumbnail() ) : ?>
<a>" rel="bookmark" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail( 'slider-thumb' ); ?>
</a>
<?php endif; ?>
<div class="clear"></div>
</article><!-- .post -->
</li>
<?php endwhile; ?>
<?php wp_reset_query();
restore_current_blog();
} ?>
<div class="clear"></div>
</section><!-- #slider -->
<?php //wp_reset_postdata(); ?>
<?php }
?>
You can look at https://todaysvisions.com to see it in action. Basically it is pulling the last sticky post from each section and displaying.
What I would like to see happen is it displays 10 posts – the most recent. So, if the Galleries had two posts today, and all the other curators had 1 post yesterday, then the art section would have two posts displayed and the others would have one – except the site that had the oldest.
I also would like to consider using transient for page page performance. Argggg… I just cannot figure it out. I know my loop is wrong.
I need to gather all the posts (could be up to 10 posts per site), store that info and then query that info for the latest ten posts. I just do not know how to accomplish this.
Thoughts? Anyone?
]]>Just wondering if anyone knows of a good plugin for me to use, or way for me to code this.
A client wants me to include a mini feed on every one of his pages (30+), displaying posts in it that relate. So, I’m assuming tagging posts would be the easiest way (right?). I just need to figure out a plugin or string of code that i can use to insert posts relating to that tag in the page. The client would have to do this themselves for aditional pages that they create, though they are seemingly familiar enough with html to be able to insert it if the part they need to adjust is simple-ish. I’d just need to write them instructions.
Thanks + PLEASE let me know if you have any advice. Really appreciate it!
tos
]]>I have a nav scroller on the page. I want each of the images in the nav bar to link to individual posts from one category. When clicked, the corresponding blog needs to display as shown in the mock-up image here:
https://billboardfamily.com/mockup.png
I want every post from that category, not a specific number. I also want the newest blog (which will be the first one in the nav scroller, also) to appear when the page initially loads. I know this can all be automated in code, and I believe pretty simply, but I do not know how to do it.
If you can help me, please let me know. I am using Theme Tester, so only logged in users can see the backend theme being worked on. I have set up a temp login https://billboardfamily.com/wp-admin
PASSWORD: sitepoint
USERNAME: sitepoint
The page this is on is https://billboardfamily.com/monthly-charities/
Here is the CSS: https://pastebin.com/ZyH75epS
Here is the code for the actual page: https://pastebin.com/XuU6276F
]]>https://code.pitch.net.nz/adm/005/blogs.html
Is this possible, I’ve a had a Google and Forum search but haven’t found a solution. Basically the authors will be static so I’ll put them into the page manually, but I want to pull each authors latest 3 posts.
Is there a way to do something like: get_posts where author_id = blah — within WordPress rather than doing a separate SQL query. Or is there a plugin that gives this functionality.
Thanks in advance for your help.
Cheers,
Ben
What I have is my blog on a subdomain, at blog.michaelnorris.co.uk… I want to display the most recent posts on my homepage at michaelnorris.co.uk/blog.php.
Can this be done?
Thanks in advance, Mike
]]>