All Questions

Tagged with
Filter by
Sorted by
Tagged with
0
votes
2answers
21 views

how to pass args for archive.php query?

I am trying to pass args to archive.php so that I can order the posts, set the number of posts, etc.. but the query is done like this <?php if (have_posts()): ?> <?php while (have_posts())...
0
votes
0answers
19 views

How to display a post(by id) along with css in a page?

I am curious if it's possible to get a post content along with its CSS (say if button background color is green on the post) and display it a page? I am able to get the content but the CSS are not ...
0
votes
1answer
218 views

Get posts in taxonomy randomly

I am having a query like this Code 1 $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); $args = array( 'post_type' => 'l', 'post_status' ...
0
votes
1answer
32 views

How to display last whole post on the homepage

I try to show on my homepage only the last post, in complete version. I tried numerous methods unsuccessfully. I tried in particular to create a specific template: “front-page.php”, in which I put ...
1
vote
1answer
43 views

Show all post for a given category

I want to be able to show all post for a given category using my default category template category.php. The problem is the code I'm using sets the specific category ID. So, whenever I click on CAT2......
0
votes
1answer
437 views

ACF: using two loops, the_field returns field content from another loop

Essentially on my single.php file, I'm querying the current post directly into the template, while having also having a related posts section. The issue is that when ACF tries to retrieve the field ...
0
votes
0answers
1k views

add_filter('query_vars') not working in custom template

I'm trying to add a query parameter to a custom template in order to look up a record from the DB with the ID passed in. Here's how I'm attempting to do it: At the very top of my custom template, I ...
4
votes
2answers
335 views

$wp_query initiation?

I'm wondering when does WordPress initiate its main query which sets the global $wp_query and enable us to use has_posts() and the_post() functions. If I create a page using archive template, how does ...
0
votes
1answer
33 views

Is it possible to query a category with specified posts?

I have a page I'm setting up with various sections to display posts. I want the majority of the page to be user-editable, so I'm filling the sections using a shortcode I wrote. Example: This: [...
0
votes
0answers
574 views

Search Filter With Custom Taxonomy and Custom Fields : How do I handle it via plugin?

I'm looking for suggestions on where exactly to put my 'results display' code. I am aware that templates are the way to handle how wordpress outputs stuff; but for the life of me, I can't figure out ...
2
votes
2answers
70 views

Pass the same object to multiple widgets in a template with one query

I am currently looking into passing a single query into multiple widgets on a template without running multiple queries. The obvious goal is speed and efficiency. I have a widget that will deliver ...
1
vote
2answers
445 views

ORDER BY wp_post custom column name in wp_query

I've alreday done lots of R&D on this question but not get a suitable answer any where. This is very little task for me if , I need to make a mysql query. But though , I' not good hand on ...
0
votes
2answers
32 views

History of page, interval of years

I'm having a customer who wants a WordPress page, and I don't have the best overview of the plugins and possibilities for this exact requirement my customer wants. He arranges an seminar once a year, ...
1
vote
2answers
198 views

Have functions work outside the loop with 404 override

I need to override the 404 code for a very specific scenario and it's not yet fully working. I am linking day archives with rel=prev/next, and the chain is supposed to be intact start-to-end. For ...
0
votes
1answer
183 views

How to generate feed for custom template

I created a custom template with its own custom query. Use case: a page for just sticky posts. Added sticky.php to the theme with /** * Template Name: Sticky */ and the following loop: $query = ...
4
votes
1answer
211 views

Executing Queries in tag.php

I'm probably being dense, but I can't seem to figure out what the issue here is. The site I'm developing uses a custom loop, with a query that excludes any posts ticked as archived. The reason I ...
0
votes
1answer
808 views

WooCommerce - Print Processing orders [closed]

On our WooCommerce webshop we have an PHP page that generates the processing orders. Now I need to show the SKU in the table, but I don't know how to do that :) Below is an example of the page as it ...
2
votes
1answer
259 views

Help with CPT template pagination

i created a themes CPT using the following code function pp_themes_post_type() { $args = array( 'public' => true, 'label' => 'ProfilePress Themes', '...
1
vote
2answers
70 views

Which custom query am I in and how can I access its properties & methods?

Sometimes there's no way around creating a custom query, but when I do and then loop through it, I often want to use get_template_part() within the custom query loop to pull in a template I already ...
-1
votes
1answer
70 views

Adding css tweak based on page template

I have a parent page that is listing out all of it's child pages. This is done using the below: <?php $query = new WP_Query('post_type=page&post_parent=80&posts_per_page=-1&...
0
votes
3answers
791 views

How to get all author posts outside of author templates

Currently, I'm trying to display all posts from an author(e.x admin) in a custom page with name that is completely different than these template file listed here. So inside this page, I'm using WP ...
0
votes
0answers
1k views

Passing query variables to a custom page template

On my website I have a custom post type called 'theme'. I wanted the homepage to display an archive of themes. For this the only approach that I could think of was to create a page template with a ...
4
votes
2answers
2k views

How to stop wordpress to make the default query?

My goal is a redirect to a custom template based on some new rewrite rule, but without having wordpress to make unusefull queries. my code: function add_rewrite_rules() { add_rewrite_rule( ...
0
votes
1answer
54 views

How can I pull information from my loop and divide them seperately?

I've created a Custom Post Type that I'm trying to implement into a CSS slider. To do this I've created a custom template and added counters to get unique ID's for every new post that get's pulled. ...
0
votes
0answers
944 views

Custom post type pagination, single page issue

After having problems getting pagination working at all for custom post types, I've read that the custom post type name and the page name cannot be the same. So I set out from scratch: I've created ...
0
votes
2answers
61 views

Unable to paginate a custom page query

I have this code on a page called Categories. <?php /* Template Name: Categories */ get_header(); ?> <section id="primary" class="content-area"> <main id="main" class="...
0
votes
1answer
137 views

Wordpress Custom Search Form Displaying Unexpected Results

I'm having an issue with a custom search form that doesn't filter results as I need it to. I need it to filter based on the date and/or category(s) selected. code used within template: <aside ...
1
vote
3answers
591 views

Single page theme

I am trying to create single page theme. What i have trouble with is understanding this whole wordpress query logic. There is query object and supposedly i get all published posts like this: $...
0
votes
3answers
57 views

Is there a way to make this kind of loop shorter and nicer?

Here is my loop code, i want to call different page templates for different pages. Please notice that this is a one-page-layout. <?php $args = array( 'post_type' => 'page' );?> <!-- get ...
7
votes
2answers
5k views

How to prevent execution of default query, while preserving ability to use WP_Query in template?

PROBLEM: I'am trying to prevent execution of default WordPress query for custom category template. I have found a possible solution, but looks like it preventing execution of all post queries: ...
0
votes
2answers
135 views

Create a Blog Template Page

I am trying to create a template that will display a list posts of a specific custom type. However, I am missing something fundamental. So far, here is what I have: functions.php add_action( '...
0
votes
3answers
413 views

Listing all custom post types using a specific term on the said term's template page, in groups

I have a custom tag-like taxonomy called PEOPLE registered to all post types - both the default and custom ones. I have created a template for a single term named taxonomy-people.php and I'm ...
0
votes
1answer
116 views

Is there a better way to pull in custom content without querying posts?

I have a custom page template that pulls in media files via advanced custom fields, as well as query posts. Now, the client wants there to be three sections by default... each one populating with the ...
2
votes
2answers
661 views

Pagination Issue: Custom Post Type In Index

I'm using a template, which uses Custom Post Type 'movies'. When I try to change the page I got 404 Not Found :( This is my index.php <div id="content"> <?php $temp = $wp_query; $page = ...
0
votes
1answer
433 views

How to stack name list in non-alphabetical order?

an update on this: I managed to change from 'orderby'=>'title' to 'orderby'=>'date'as suggested. This almost made the order perfect except one clarinet that falls out of the order and is placed in ...
9
votes
5answers
28k views

Page template query with WP_Query

I would like to query only pages with a certain page template with WP_Query or a function that would return the post object, but I can't find any information about that on the official codex.
0
votes
1answer
47 views

odd behaviours from template tags

Some of my template tags are playing up, and they have left me confused. On one site, that has been live for over a year without any of these issues, on all the pages that have custom query loops, ...
0
votes
1answer
103 views

problem with the loop

Hello I am working with my own template, and also using the post-to-post plugin, I am doing the following, <ul> <?php global $post; global $...
1
vote
1answer
605 views

On Taxonomy Template page, want to add Post_Type

I have a custom taxonomy template page in my theme. Essentially, when someone clicks on a term link into this taxonomy, I -ALWAYS- want to add a specific post-type to the query. I'm not entirely ...