3
votes
1answer
45 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
28 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' => ...
0
votes
1answer
108 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
63 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
0answers
81 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
72 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
50 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
122 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 = ...
2
votes
1answer
259 views

Endless loop with wp_insert_post and wp_update_post

I have an array $unqiues which contains URL's, I loop over the array with the code below to get the URL titles, insert a new post, update the post meta. Then I change the the posts title and name to ...
-1
votes
1answer
1k views

Eliminate duplicates in a foreach loop [closed]

I've created a filter for my search results that allows people to filter user searches based on their State from their profile. The problem I am having is that there are duplicate states showing in ...
0
votes
2answers
69 views

Way of getting queried loop before the query with a filter hook?

Is there a way to get the results of a loop with a filter before the code for the loop is performed in the structure of your code? My markup is something like this: <body> <div> /* ...
0
votes
2answers
221 views

How to check all items in a loop have post thumbnail?

Currently I have the following loop: <?php $shows_sales = get_posts(array( 'post_type' => 'show_sale', 'post_status' => 'publish', 'posts_per_page' => 3, )); $done_image = ...
0
votes
1answer
277 views

Loop not displaying comments_popup_link

I cannot get the comments_popup_link to display with the posts retrieved by the foreach loop. Only the title and permalink are displayed. Any idea why the comment link is left out? <?php ...
0
votes
2answers
202 views

Lists Top Authors by Most Recent Posts

I'm trying to display a table format of the top authors listed by the most recent posts. It should display the author, its avatar, the date, and the title of the post (with a link). I have it ...
1
vote
1answer
630 views

Loop through child images of a parent for a Nivo Slider

I want to use a Nivo slider to cycle through the children of a parent page one by one, how can I do that? I have the following piece of code that grabs ALL the children of a parent page and displays ...
0
votes
2answers
333 views

Simple foreach loop help needed in wordpress “the loop”

I need a foreach loop inside "the loop" This is my current code (index.php) : <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div><a href="<?php the_permalink(); ...
0
votes
1answer
1k views

Display metabox title for custom fields with values

I'm using multiple metabox panels in my write posts. IN my functions I'm registering multiple metaboxes: $prefix = 'dbt_'; $meta_boxes = array(); $meta_boxes[] = array( 'id' => ...
0
votes
1answer
401 views

Retrieve IDs from custom field, count and display results differently according to count

The function below is inside a single post loop. I have an array of IDs in a custom field. Such IDs represent related posts. I'm using Advanced Custom Fields (ACV) plugin and I manage the custom ...
0
votes
2answers
457 views

Add class to last 3 posts in loop

I have this code so far, which adds the classes first, second, and third to every first, second and third post in the loop. It also adds a class to the first 3 posts in the loop. But how can I make it ...
1
vote
2answers
4k views

In a foreach loop, how do I target the last item in the loop?

I have the following code to do a foreach loop, I want to target the last item in the loop (e.g if it's looped over 3 events I want to target the 3rd event) to do something slightly different with the ...