0
votes
0answers
37 views

Run a Wordpress function inside a wp_query loop result [duplicate]

I have a search results page that displays multiple results in a multi column layout. I am trying to run a function via a button/link that will allow users to add that post to a "favorites list". The ...
0
votes
1answer
34 views

Remove echo from shortcode

I've just started playing with shortcodes and due to my lack of php knowledge I am unable to figure out how to make this shortcode work without using php echo. Can anyone help me revise my code? // ...
-1
votes
2answers
24 views

How to modify this function to exclude also the post belonging to a specific category?

I am very new in WordPress development and I have the folglowing problem. I use this function (declared into the functions.php file of my theme) to modify the main query in such a way that the post ...
0
votes
1answer
23 views

Query function not executed between <div> element [closed]

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 ...
0
votes
2answers
28 views

Pagination custom query

I am trying to make a custom page template that shows the most viewed posts. I can return posts but I am having trouble figuring out how to paginate it. Here is what I have: $args = array('orderby' ...
0
votes
0answers
60 views

Filter Wordpress post Dynamically on dropdown selection?

Want to filter Wordpress post Dynamically on dropdown selection? But am not able to find out any solution how it can be done.Any help appreciated. Thanks On Clicking On Latest to Old the post ...
0
votes
1answer
61 views

List sibling pages widget, exclude current page

I successfully created a widget that displays sibling pages to the current page I'm on in the sidebar. Only thing is, I'm not capable of excluding the current page - can someone please assist here? ...
0
votes
1answer
28 views

Displaying Event within two given time frames

I'm trying to display two different posts from my CPT named Events. One is going to be the next event the other is going to be previous event. I've got a metabox called 'Event date' The client at ...
0
votes
2answers
29 views

How to get any tag ID

I want to exclude a certain tag from my home page not a category only post that hold the tag for example "olive"; I found a function for that which is like this function exclude_tag($query) { ...
0
votes
0answers
71 views

Creating Content for Custom Tab in WooCommerce

I'm working with a set of three products in WooCommerce, each of which is made up of multiple "items" (custom post types). These are linked to the product using a relationship custom field. In my ...
0
votes
1answer
84 views

Error with function in functions.php?

I am using the below function in my custom theme to load posts via AJAX. But for some reason it is breaking the WP ADMIN WIdget Drag and Drop and also showing the White Screen of Death when I uploaded ...
1
vote
0answers
52 views

Configuring a meta query with multiple post types that have the same relationship on a single page

I am creating a client portal were my clients can maintain their projects and leave feedback. I have two custom post types called "Clients" and "Projects" and they each pull information from one ...
0
votes
1answer
48 views

relation OR instead of AND - Filtered term ID's in loop

Question not related anymore.. First I tought about the relation OR/ AND for results, but I believe I should work with 'operator' => 'NOT IN'. I would like to query the results that meet multiple ...
1
vote
1answer
1k views

Get current post id in functions.php

I have a wp_localize_script() function in my functions.php where I need to push the current post ID of the current post to a jQuery file. So I was wondering how you can get the current post ID of a ...
0
votes
0answers
281 views

Why WP_Query in functions.php is not working when get_posts works?

I have following code in my functions.php. When I try to add new post_type (e.g. post,lawyers) it fills excerpt,slug (this affects in permalink structure), other metaboxes from first post of lawyers ...
0
votes
1answer
121 views

Foreach loop returning more than one item when querying taxonomy

I am querying the taxonomy terms and then listing the posts that are under those terms. The taxonomy is basically a category for a custom post type, and the terms in it are the categories. I didn't ...
0
votes
0answers
30 views

how a query can use local parameters in plugin function?

I've wanted to add a custom post type, so i've done a plugin to put on/off this post type. i have widgets inside the plugin in order to print posts with this custom type, that call more or less a ...
0
votes
1answer
63 views

Optimizing multiple WP_querys into one call?

I have finished building my website and noticed due to the structure it takes 3 seconds to load the data due to each WP_query bouncing between different post types. I was wondering if I put these into ...
0
votes
1answer
27 views

How to get category pages to look like a certain archive page?

I'm not sure if this question has been answered, I'm not sure of how i should have even worded this question but... I have a custom post type called videos and the style of the archive is different ...
2
votes
0answers
43 views

How to show in search results posts with a particular tag in a particular category?

As the home page of my blog I've a static page. There I want to show the navigation of the site. Category1 Sub-Category1 tag1, tag2, tag3 Category1 Sub-Category2 tag1, tag2, tag3 ...
1
vote
1answer
326 views

Auto Populate Custom Field with Complex Value That Increase by One?

Can somebody help me to sort this? I am using WP 3.5.2 and I have "Orders" post type where purchase_order custom field is located. This is the sample of purchase order record: POCOS20130051 PO - ...
0
votes
1answer
32 views

Same post appears in related Posts?

Here is the code function dark_delight_get_related_posts(){ $post = get_post(); $args = array( 'posts_per_page' => 4, 'ignore_sticky_posts' => true, ...
2
votes
1answer
416 views

Gravity Forms field entries into wp_query loop

I have a simple function that filters the page content when form (ID 18) is submitted. It simply displays the entry of field (ID 13)... add_action("gform_after_submission_18", "set_post_content", 10, ...
1
vote
1answer
573 views

When tax_query used, results disappear (0 =1 produced)

I'm trying to perform a dynamic query that uses a dynamically passed taxonomy and post_type, and displays results accordingly — A user makes a selection from 3 drop-downs on a form, each have a ...
0
votes
3answers
169 views

Show only one category in main query, issues on tag page

I altered the following code from Ashfame: add_action('pre_get_posts', 'block_cat_query' ); function block_cat_query() { global $wp_query; if( is_home() || is_search() || is_tag() ) { ...
1
vote
1answer
120 views

list tags with count in author profile page

I would like to list tags with count in author profile page just like this page If the user click the tag, then I would like to list the tagged posts. Can someone help me?
4
votes
2answers
761 views

Build a content and excerpt grid loop with paging and options for # of posts

What I'd like to do: on index.php, a loop that shows a selectable number of full posts using the_content and then below that shows a selectable number (the number of posts can be hardcoded in the ...
1
vote
2answers
203 views

Having a Function Inside of the Loop

I am trying to make a frontend product editor for WooCommerce, and have a loop that returns all of the products for the current user. I am trying to use gravity forms as the editor, so a single ...
0
votes
2answers
69 views

Query is not work

I use this codes in my functions.php to track post views. /* Functions to track Post Views*/ function getPostViews($postID){ $count_key = 'post_views'; $count = get_post_meta($postID, $count_key, ...
1
vote
1answer
485 views

Display tags that only appear in one category

I'm trying to get this less manual than it currently is. I want to display tags that appear in only a single category, so if they are in a post that has two categories, I want that tag ignored. The ...
0
votes
1answer
124 views

Custom Query Not Paginating

I have a site that uses a custom query to filter posts: <?php //Search Region table to retrieve array of country names $regionresult = mysql_query("SELECT * FROM gallery_regions WHERE ...
0
votes
1answer
424 views

Replacing global wp_query

I have a site that uses a custom query to search for posts by country. The search results come back fine, but the pagination at the bottom reflects the total number of posts in the site, instead of ...
2
votes
2answers
2k views

WP_Query in functions.php

I've got some code that I want to turn into a function. It works great until I wrap it in said function: $args = array( 'posts_per_page' => -1, 'post_type' => ...
0
votes
1answer
185 views

How to apply the 'current_page_item' class to an archive page in `wp_list_pages()`?

So I have the following custom wp-query working on my site: function custom_front_page($wp_query){ if($wp_query->get('page_id')==get_option('page_on_front')){ ...
5
votes
3answers
2k views

How to use a custom post type archive as front page?

I'd like to use a custom post type archive as a site's front page, so that http://the_site.com/ is a custom post type archive displayed according to my archive-{post-type}.php file. Ideally I ...
-1
votes
1answer
274 views

Integrating custom API for post content into Admin interface & Public Website [closed]

EDITED question to be more specific and added bounty in hopes someone has a solid coded solution: So, here is an interesting task I have been trying to find a solution for. I have added a bounty ...
0
votes
1answer
366 views

Filter for replacing the WP_query object for a given category

I'm looking for a action/filter to replace replace a category archive page with the contents of a page. I'm thinking of testing the category ID, and replacing the WP_Query object with a new one ...