Articles of query posts

Remove Post if Advanced Custom Field is checked to fix paging

I’m trying to setup a query that filters through posts and removes ones that have an ACF field “archived” checked. Post queries are pretty foreign to me. query_posts(“cat=10&posts_per_page=12&post_status=any&order=ASC”.”&paged=”.$paged); How can I edit that string to check to see if the post has the archived checkbox checked? This is how I’m currently doing it, but because […]

Custom post query error

i have a ~46k rows in my wp_posts. All i want to do is to query the database that meet my queryes and display the resulted posts but my problem is that any query that i`m doing to the database it display only the last 5 entryes that were added. Thats the code: if(isset($_GET[“submit”])){ $nume_searchq=$_GET[“nume_doc”]; […]

How to save posts position on homepage after random function?

I use the following code to display a random post on a homepage: <?php global $query_string; query_posts($query_string . “&orderby=rand”); ?> When the page is refresh posts positions are reversed. Is it possible to retain posts positions for a while? I want that posts positions are change once an hour.

Query function not executed between <div> element

I’m wondering why the following code is not executed between the element it’s put in. I know sort of how to fix, but I’m not sure if that’s the best solution. My code: First function function myfunction1($args = array()) { var_dump($args); $output = null; $output .= ‘<div id=”mydivelement”>’; $output .= myfunction2( $args ); $output .= […]

Exclude a category of posts in author template

I’m using the following author archive code: <?php /** * The template for displaying Author Archive pages. * * @package Cryout Creations * @subpackage Parabola * @since Parabola 1.0 */ get_header(); ?> <section id=”container” class=”<?php echo parabola_get_layout_class(); ?>”> <div id=”content” role=”main”> <?php cryout_before_content_hook(); ?> <?php if ( have_posts() ) : ?> <?php /* Queue the […]

Saving a post ID to use in a form elsewhere on website

I am trying to save a certain queried post’s ID to pass on in a form outside of my loop. To be more specific. I have one file named review.php, this file contains a WordPress Loop which queries one post at a time. In my sidebar.php I have a form setup which will only display […]

Get postlist for each category using query_posts?

<?php $cat_name=array(‘Breaking News Stories’, ‘Call-out’, ‘Featured Story’, ‘Standard Stories’); $count=count($cat_name); /*Get category_id by its name*/ for($i=0; $i < $count; $i++) { $cat_id5.=”‘”.get_cat_ID($cat_name[$i]).”‘,”; //$cat_id4.=”‘”.$cat_id5; } echo $id1=rtrim($cat_id5,’,’); //query_posts(“cat=$catIDs&showposts=4”); $args=query_posts(array( ‘category__in’ => array($id1), ‘posts_per_page’ => -1, // ‘category_name’ => array(‘breaking-news-stories’,); //’category_name’ => array(‘category_name’ ,’breaking-news-stories’) )); $posts_array = get_posts($args); print_r($posts_array); ?> When I’m using the above code, I’m […]

limit number of post for achive page

Im trying to limit the number of post for my archive page, in a specific category. I’ve manage to display post from just the category I desire, However, if i setup a loop to limit the number of post, it doest work but display post from all time, instead of the specific time . . […]

List all posts in taxonomy term

I have a custom post type called anime and a taxonomy called series. If I view any post and that post belongs term Banana it should list all the posts in term Banana in a dropdown list. Here’s the code so far: <?php $category = get_terms( ‘series’ ); $catID = $category[0]->term_id; $args = array( ‘numberposts’ […]

2 queries with counters

I have 2 loops on a page both containing a counter to implement slightly different code every 6 posts. For some reason though the second loop is implementing the different code sometimes after 4 items instead of 6. Am I not resetting the loop correctly? <ul class=”tabs”> <li class=”tab-link current” data-tab=”tab-1″>Most Popular</li> <li class=”tab-link” data-tab=”tab-2″>Recent</li> […]