The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
2answers
229 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
46 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
104 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. ...
2
votes
1answer
112 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 ...
3
votes
1answer
292 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
vote
0answers
244 views

Set default value for radio button in WP Alchemy custom meta box?

I'm using the WP Alchemy Metabox PHP class (www.farinspace.com/wpalchemy-metabox/) to add a custom meta box with a radio select to a custom post type. The code below shows the code I'm using for the ...
0
votes
1answer
46 views

If no author posts, echo out some text

I have this piece of code to show the author posts of the author of the current post, but I want to make an if statement, if no posts then echo out some text. I have now this but it do not work (above ...
0
votes
1answer
49 views

Display only the latest post

There seems to be something wrong with the logic of what I'm doing. I just want to display the latest post in a custom term. But instead I'm displaying every post for that term, even though I am ...
0
votes
1answer
87 views

Show message if statement is false - foreach

I got this PHP script from http://tutorialzine.com/2010/02/php-mysql-download-counter/ and integrate it to my wordpress successfully. It works but the "No Download File" message appears even the value ...
0
votes
1answer
730 views

Display post thumbnail in foreach loop

I am trying to display a thumbnail in a foreach loop. The thumbnail is a new image size I have added called "plant-thumb". I have all the desired elements displaying properly except for the thumbnail. ...
0
votes
1answer
118 views

Getting “Invalid argument supplied for foreach()” Warning

I am on the last step in a tutorial that I followed here , called "Using the data". I tried using// $album_repeatable = unserialize($post_meta_data['album_repeatable'][0]); echo '[ul ...
0
votes
1answer
474 views

Add number in increment of one to DIV ID

I'm using a shortcode to display a custom post type. The shortcode contains an attribute to display only posts of a specific category within the custom post type e.g. [faq category="travel"] For each ...
0
votes
1answer
123 views

How to remove certain words from url slug

Trying to create a SEO plugin, that will remove stop words from slugs. This is how to explode the $slug into a list, and explode the variable containing the stop words : add_filter ('sanitize ...
-1
votes
1answer
2k 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 ...
1
vote
1answer
2k views

Custom widget using get_categories select menu dropdown

I have created a custom widget that is supposed to display a select menu with all the categories the blog has. I have used get_categories to compile the list. This works fine and all categories appear ...
0
votes
1answer
114 views

Paginating a list of all posts collected by category titles

I'd be really grateful if anyone has any ideas about what might be wrong with this code or, alternatively, could suggest an entirely different way of achieving the same aims. I have a site (staged, ...
0
votes
1answer
700 views

Pagination for multiple queries merging into one Loop

I have an events site where I want to display upcoming events that can be booked in ascending date order and then events that are closed for registration in descending order. I'm using get_posts for ...
0
votes
1answer
449 views

update_post_meta only updating on last loop of foreach

I'm building a way to upload multiple files for an announcement custom post type on the front end. My function here uploads any number of files succesfully so I can see them under "Media" in ...
1
vote
0answers
19 views

How to write an efficient metabox with repetitive fields [duplicate]

Possible Duplicate: Create more Meta Boxes as needed I’m having a hard time to write an efficient code for the below Metabox. Since I do not want to use any third-party class, I’m trying to ...
0
votes
1answer
595 views

How to get the next and previous image title from attachment or gallery?

I'm trying to build a slider exactly like this in wordpress. I have managed to make the slider work except the next/prev button. I need to get the next image title and the previous image title for the ...
0
votes
1answer
174 views

Insert new post for each user infinite loop error

I wrote this little function to automatically create a post for every user of the blog but it creates an infinite loop (I disabled it to stop it creating new posts). I'm not very skilled in php, I ...
0
votes
1answer
153 views

How to reduce three query to one in multiple output template?

I would like to publish 7 posts from the same category but embedded in different DIV or UL. How could I simplify this code? <?php $query01 = array( 'numberposts' => 1, 'offset'=> 0, ...
3
votes
2answers
876 views

Display data from a non wordpress database on a page template

I am using a sql query to access information to display on a wordpress page by adding the below code to a page template. I know the query works as I've tested it in phpmyadmin. $rows = ...
0
votes
1answer
322 views

foreach repeat html structure after every nth for attachment [closed]

I am trying to achieve result with below structure in foreach loop where after every two images it will repeat entire structure. I have some basic knowledge for something I can use eg. counter++; and ...
0
votes
2answers
535 views

Meta Box Plugin Cloned Fields - Multiple Foreach values

I have the following code that I can't get working. I have two cloneable fields that are being output as one entity (URL and thumbnail image). These are cloned fields using the Meta Box Plugin by ...
2
votes
2answers
972 views

Count total number of post in foreach loop

I used the the following script (only with get_permalink....) to display posts from a post type where the post author has an extra meta field on his user page: <?php // get users from user page ...
0
votes
2answers
71 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
1answer
336 views

Compare current post Category in select menu

i have done this many times but not via a form so i am getting a weird issues when trying to assign a "selected" based on the current post term id... Maybe the use of get_the_category and then ...
0
votes
1answer
436 views

Why use foreach to get attachment_id if numberposts is equal to 1?

I needed to pass an image to a Pinterest plugin in posts without a Featured Image so I wrote a little function to get the id of the first picture in a post. This code is in the loop-single.php where ...
1
vote
1answer
265 views

Get posts inside Get terms problem

i have a get_terms which loads correctly. inside of it i have used get_posts. then using get posts i am trying to get each post tags (and count <= not currently inside this script) <?php ...
0
votes
1answer
517 views

Passing a variable from a FOREACH loop in a link

How would you pass a variable from a foreach loop, through a link? I have tabs that display correctly. The jQuery works. But when I call the variable $category down where the content sorts, $category ...
0
votes
1answer
426 views

Sets post_parent in custom post type posts automatically based on cpt->page name

I'm trying to write a function that will "pair" my custom post type with a page with the same name as the custom post type. The aim is that when a custom post type is saved, it checks if there's a ...
0
votes
2answers
98 views

How to randomise my menu items?

So I thought I could do it like this (also I want to only get 3) - $menu_items = wp_get_nav_menu_items(26); $menu_items = array_rand($menu_items, 3); foreach ( (array) $menu_items as $key => ...
0
votes
2answers
230 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
315 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 ...
4
votes
2answers
6k views

How to get permalink and title from post ID?

I have stored an array of post IDs and I would like to list the posts as links, meaning I need to get the title and permalink for the post ID - $id. The list should be echoed out by the following if ...
0
votes
1answer
323 views

Can't seem to get set_blog_id working, it just doesn't reset the blog ID

Trying to iterate through a list of the sites and I can't seem to get set_blog_id working. Here's the sample output: Array ( [0] => stdClass Object ( [blog_id] => 2 ) [1] => stdClass Object ( ...
-1
votes
2answers
288 views

Different Output for “Every Other” Foreach Statement?

I'm currently using the following code in order to get subcategories in a category page and getting the posts foreach subcategory. In the part where it echos "span-12" (line 14) i want it to echo ...
0
votes
2answers
203 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
659 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 ...
-1
votes
1answer
660 views

Combine two foreach Arrays into one table row

right now I have two foreach arrays - one outputs the artist, the other a track title I would like to combine both so there is a row for each artist and corresponding track for example: Row 1 - ...
0
votes
2answers
364 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(); ...
2
votes
1answer
512 views

Advanced Custom Fields - Storing array value for further usage

This might might be more of a PHP question - but does deal with a WordPress plugin, Advanced Custom Fields I am using a global select option to store a specific Location (custom post type) as the ...
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
416 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
725 views

Code that displays images - images get shown multiple times

On My category.php page i've got a list of categories with the title and the description. Here's the code: <?php $cat_id = get_query_var('cat'); $catlist = ...
0
votes
2answers
480 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
3answers
267 views

query in category.php repeats itself

I'm need some help on my query. I'm building up a category page where on top a post need to show where custom field key 'uitleg' has value 'ja'. Per category there is only one post with that value. ...
0
votes
3answers
572 views

Custom Database Table and foreach

I have just created a custom database table and would now like to output every inserted row from it into a predefined format using a foreach statement. Some guidance in this matter would be great. ...
0
votes
1answer
2k views

Count within foreach loop

How can I echo out the count of within a foreach loop? I want to change the class of the div below so it's menu-button-1, menu-button-2 etc etc: <?php $pages = get_children(array('orderby' ...