The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
0answers
10 views

foreach loop pagination for taxonomy blog category [duplicate]

I have a wordpress website running in which I have a blogs page where I display all the blogcategories using the following code <?php $taxonomy = 'blogcategory'; ...
0
votes
1answer
28 views

Custom post type archive organized by category

I'm trying to display a custom post type archive page which displays all the articles of a a custom post type in columns. The columns organize them in their assigned category. On the main page, I do ...
0
votes
1answer
17 views

foreach loop inside the loop creating duplicates in output

I have a foreach loop inside the loop that is getting info from a separate table. The table has a column that has an id that reflects the id of the post type so it should always be unique. When I ...
0
votes
0answers
21 views

Remove duplicates from foreach

I'm trying to loop through a custom post type and display all meta values for a meta key. I'm able to display all the values, however there are some duplicates. I want to remove those duplicates. I ...
0
votes
2answers
56 views

Category foreach Paging

I'm using the following code to display categories on my homepage, what I'd like to do is add the ability for paging with previous and next links, I haven't been able to figure out how to do this with ...
3
votes
1answer
50 views

Add Incrementing ID to each paragraph in the_content

I need to loop through each paragraph in the_content and add an ID to each paragraph with an incremental value. function incrementparagraphs( $content ) { for ($i = 0; $i <count($content); ...
0
votes
2answers
29 views

Foreach displays from last to first

I created the foreach loop to display post images, but It displays them from last to first, how can I make It to displays from first to last ;) ? <?php $args = array( 'post_type' => ...
1
vote
2answers
58 views

Apply different Class for each element in a foreach()

sorry for the silly question, but I am really lost. I want to apply the following CSS to the even elements of my foreach. CSS .blogArticles a { float: left; max-width: 250px; width: 25%; ...
0
votes
0answers
47 views

How to filter the terms to a special custom taxonomy?

I do have a custom taxonomy called "countries". With the code below I get for each term (country) the number of its published posts in brackets, like the following: Canada (3) USA (5) Italy (2) ...
0
votes
2answers
19 views

How can I hide my section title if there is no data in custom fields?

I wrote this function with a foreach and I'm not able to figure out how to hide the section title if there are no custom fields in $lista. Where should I place the section title? function ...
1
vote
3answers
78 views

Display the number of published posts for each custom taxonomy term?

I do have a custom taxonomy called "countries". How do I get each term (country) with the number of its published posts in brackets, like the following: Uruguay (3) Chile (5) Thailand (2) etc. ...
0
votes
1answer
49 views

Change page template programmatically inside foreach

i have been trying to attach multiple pages, eash to its page-template using a foreach loop... Manually meaning writing each page code works but inside the foreach loop it wont work. I have several ...
0
votes
0answers
30 views

Edit a custom admin page

I have created a custom admin menu page with: add_menu_page This page uploads a form to the wp_options table in the database. Basic save with update_option like: function addressbook_save (){ ...
0
votes
2answers
67 views

Save checkboxes of a metabox with a foreach loop (invalid argument)

I'm new to Wordpress plugin development and I'm trying to create a list of checkboxes (from a WP Query) to associate as custom fields for a specific post type. Nothing wrong with the display function, ...
0
votes
1answer
169 views

ACF checkbox array is returning numbers, not labels [closed]

I am using Advanced Custom Fields and the add-on Repeater to create a field in the admin through which a user can select multiple icons. Each icon has an associated label, and I'm trying to return the ...
0
votes
1answer
24 views

Why is only the first operation run in my loop - except for on the last repeat? [closed]

We have a custom walker displaying only the sub menu of the current top menu and while making some changes to it I ran into something I don't get - for some reason only the first echo of each loop in ...
0
votes
2answers
69 views

List posts by their custom taxonomy term, with a condition

I have two custom taxonomies called "custom-category" and "file_type". I am using the below code to list all the terms of "file_type" along with their associated posts. Like so: File_Type Term 1 ...
0
votes
1answer
138 views

Display post category in foreach loop with category link

I have the following code to show current author post lists with post thumbnail, post title, post date and post category. function my_get_display_author_posts() { global $authordata, $post; ...
0
votes
2answers
177 views

Display post category in foreach loop

I am trying to display post category in a foreach loop. I have all the elements displaying properly except for the category. Here is my function: function my_get_display_author_posts() { global ...
0
votes
1answer
41 views

Get foreach for meta_query value

How can i get meta_box foreach value inside meta_query value, here is code: $my_id = get_post_meta(get_the_ID(), "artist_name", true); $artistNames = array(); foreach($my_id as $id) { ...
0
votes
1answer
67 views

How can I return multiple image attachments with wp_get_attachment_image_src

I want to return multiple image attachments to my template landing page, but wp_get_attachment_image_src only returns the first image attachment. How come? Thanks in advance <?php /** ...
-1
votes
1answer
48 views

Foreach giving one too many list items, how can I remove the last empty line?

Hello Stackexchange users! I built a simple function to display a list of items from custom fields. However it is listing an empty last field on the front end and I cant figure out how to remove it. ...
1
vote
1answer
100 views

Show list of authors with latest post NOT older than a month

I found two bits of code. One gets me posts NOT older than a month the other bit gets me a list of authors and their custom fields, names, etc. Can someone please help me integrate the two. One runs ...
1
vote
3answers
66 views

get_*_meta doesn't always return an array

I find it annoying that functions like get_user_meta or get_post_meta will return an array if the meta key exists or false if it doesn't. This means I need to do a check like so: $meta = ...
3
votes
1answer
39 views

foreach error on false boolean from get_terms

I'm grabbing an array of page ids that were created in another function which I use regularly- that's all good. The issue I have is in the below function. Some pages have not been assigned an ...
0
votes
2answers
70 views

post__in - Placing content from a foreach loop inside of an array

I know this code is incorrect, but it's a basis of what I am trying to achieve. I am parsing an xml feed via PHP and running a foreach loop to get a value from a specific key. Here is the snippet I ...
0
votes
2answers
316 views

How to use Wordpress Conditional Tags in get_posts foreach loop

I have a page which has a jquery tab function to output the list of pages that are the children of this page (Bio, Archives, Contact). However I am trying to make a conditional in the foreach loop ...
0
votes
1answer
29 views

Store Foreach in user profile

I use a foreach to get visits / visitors per month with Analytics API. I need to store the results in the user profile the way it is displayed with an echo. I tried this but I don't get the right ...
0
votes
1answer
106 views

How can i show pagenavi in my author.php?

With this query in author.php i show all posts from a specific author_id/name/slug. But the problem is when i set the minimum of posts to show in the page. I have tried with posts_per_page= but if i ...
0
votes
0answers
83 views

How to output data from meta box with cloned fields?

Just to let you know, i am at a beginner level with PHP, so please bear with me : ) Also, I looked at this post and I did not find it helpful in my case, so I am making a stab at it here. (Meta Box ...
0
votes
0answers
80 views

JQuery is only applying to first post in loop

I have a JQuery script that creates 'arrows' that allow for my textbox to be scrollable, the problem is JQuery is only apply it to the first post (you can see none of the other posts have the arrows). ...
0
votes
2answers
110 views

Displaying values from related field - if empty shows current post type's link and title

I'm working with custom post types. In the post type awards I have a relationship field that links each award to a post from the post type project. I'm using the following code to return the values ...
0
votes
3answers
102 views

Conditionally set post_content in wp_insert_post

Is it possible to conditionally set the post_content in wp_insert_post? Im using a foreach to add multiple pages at once: foreach ($create_pages as $new_page) { $add_pages = array( ...
2
votes
2answers
126 views

How can i get the last post from wp multisite?

I have to get the last post from my Multisite network on WordPress. For now I use this code for display the last updated post after a cycle on each blog_id: <?php $blogs = get_last_updated(' ', ...
0
votes
2answers
68 views

Create menu locations for each category in wordpress

I need display a special menu in each category page in wordpress, for example I have 3 category: horse,dog,cat So I must have 3 menu in Menu Settings locations with name: horse,dog,cat with this ...
0
votes
0answers
31 views

Get_post_meta returns Array instead of actual value [duplicate]

With the PODS plugin in Wordpress, I've created a custom post type called project. Within project I've created a few custom fields. One of those is project_thumb. The thing is; When I want to display ...
0
votes
1answer
62 views

List all pages including archive

I'm creating a custom options page on my site. One of the options is controlling a box on the homepage and i'm trying to set the link for the item to any page on the site via a select menu. as of now ...
0
votes
0answers
31 views

Get parent taxonomy's name of custom post?

I have a foreach-loop that looks like this foreach($selected_courses as $postid) { $course = new WP_Post($postid); } where $selected_courses is an array of ids based on a form submit. ...
0
votes
0answers
22 views

WP supersize not displaying when different languages flags are selected

I've got a very strange problem with this website. The background slides appear when your English flag but when its switched to The Spanish flag or Other flag the backgrounds don't appear. Link to ...
0
votes
2answers
52 views

Order by custom field attribute

I'm try to get the output of this post type to order by the staff name alphabetically and I can't seem to figure out if needs to be within the beginning array() or if I been do something within the ...
0
votes
1answer
146 views

Woocommerce Attributes pulling in wrong data

My Problem is very strange - I don't fully understand all the aspects of woocommerce just yet and am still fiddling with things to understand it. I'm trying to pull in the size attributes for each ...
0
votes
1answer
134 views

Second level subcategory

I'm trying to get anoter level subcategory to show in my select option. I've managed to get one... how can i get the other? <?php $taxonomies = array(CUSTOM_CAT_TYPE); $args = ...
0
votes
1answer
199 views

foreach pagination

I am looking for help in how to paginate my foreach output. I've looked at other questions and answers and cannot find a solution that works for me or that I can figure out on my own. Right now my ...
0
votes
2answers
185 views

Display Random Thumbnail from Category

I have a feeling that I'm on the right track, I just don't have enough solid PHP knowledge to get much further than where I'm currently at. I'm currently using the following code to return a list of ...
0
votes
1answer
44 views

Wordpress multi-query not returning as expected

I am trying to perform a merged query to get at most 6 posts from either the post post type and my events custom post type. The post query is based off of whether or not the Featured Image is set, and ...
0
votes
0answers
98 views

Trying to combine multiple Wordpress queries

I am trying to query multiple post types and meta values in Wordpress... the query is trying to fetch event post types with a featured meta key, as well as post post types with the featured image set. ...
0
votes
0answers
132 views

Advanced Custom Fields Repeater sorting by category

Basically in my ACF repeater I have a select field and I want to display the content in sections that relate to the value of the select field..? Example: In the select field I have four options.. - ...
0
votes
0answers
65 views

Foreach Columns & Pagination

I am using the plugin "Categories Images" and using a foreach statement that I am trying to adapt for display of 11 items in three rows for a yearly magazine archive. The 11 items are custom category ...
2
votes
1answer
87 views

Listing all capabilities in dropdown is returning boolean

Trying to put a list of all possible caps in a dropdown. I can only get it to return 1s (boolean true). If I use var_dump($user->allcaps); it does produce the actual cap names, but when I plug this ...
0
votes
0answers
44 views

Pagination on Custom Gallery Template : get_children() and foreach loop [duplicate]

With the help of this WordPress.org Support Thread, I made a Page Template for a custom designed photo gallery of 4 columns with the following codes in a TwentyThirteen theme: <?php /* Template ...