Exclude posts based on an array

You’re looking for post__in & post__not_in parameters http://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters Both of them are an array of ID’s for the post’s to include or exclude in the results BTW in your code, you had a semicolon just after your foreach

Iteratively add sub shortcodes to php array

Your data structure appears to be very list like. The reason you’re running into difficulties is because you’re trying to fix a fix, which is never a good thing. Instead I would suggest you seek alternative solutions to your problem. For example, instead it would be more logical to use something like: <ul class=”component”> <li>content … Read more

Finding and removing duplicates within WP Arrays

If you only want to collect the category+tag names into the output, you can try this <?php global $post; $words=array(); $tags = wp_get_post_tags($post->ID); foreach($tags as $tag){ $words[]=”%23″.$tag->name; } $cats = get_the_category($post->ID); foreach($cats as $cat){ $words[]=”%23″.$cat->name; } $words=array_unique($words); echo implode(” “,$words); ?>

update_user_meta duplicates entry

You are overwriting the existing values instead you should check if existing values exist and concatenate the new values to existing values if it is exist as following if (is_user_logged_in()) { $user = wp_get_current_user(); $aka2 = get_user_meta($user->ID, ‘last_visited_blogs’,true); if($aka2) array_push ($aka2, ‘blog4’); else $aka2 = array(‘blog4’); update_user_meta($user->ID, ‘last_visited_blogs’, $aka2); }

Meta value Array

If I understand you correctly, I don’t think this is a WordPress issue, just PHP. When you var_export into the textarea, then submit that via POST, what you then have is not an array but a string. You can check is_string instead of is_array to confirm this. If you want it to be an array … Read more

using images in next/previous_post_link [closed]

The path of image is incorrect. Change #blog .pagination span.left-arrow { background: url(‘arrow_left.png’) no-repeat; } #blog .pagination span.right-arrow { background: url(‘arrow_right.png’) no-repeat; } to #blog .pagination span.left-arrow { background: url(‘img/arrow_left.png’) no-repeat; } #blog .pagination span.right-arrow { background: url(‘img/arrow_right.png’) no-repeat; }

Remove from array in WP_Query loop

This is happening because you are re-initializing the phrases array on each iteration. Define that array outside the loop and this code will work. <?php $frontAgrs = array( ‘post_type’ => ‘page’, ‘tag’ => ‘word’, ‘order’ => ‘ASC’ ); $frontLoop = new WP_Query($frontAgrs); /*—-Phrase————-*/ $phrases = array(‘Hello Sailor’,’Acid Test’,’Bear Garden’,’Botch A Job’,’Dark Horse’, ‘In The Red’,’Man … Read more