Get current user array into hyperlink

I would set up an array with the variables you want in the url query string and then use http_build_query(). Like so: $args = array( ‘AT’ => ‘EN’, ‘AE’ => $current_user->user_email, ‘FN’ => $current_user->user_firstname, ‘LN’ => $current_user->user_lastname, ‘MK’ => 665080128, ‘PW’ => ‘miami’, ‘BU’ => ‘http://thinkmcat.com/’); ?> <a href=”https://thinkmcat.webex.com/thinkmcat/m.php?<?php echo http_build_query($args); ?>”>LINK</a>

Get the values from an array string to work with post__in

Problem here is that, post_in accepts only array of post IDs and implode() returns string. Here’s how fixed code should look like (also added few conditional checks): $sel_ids = $_SESSION[‘selected_ids’]; /** * Check, if we have array of Post IDs */ if ( ! is_array( $sel_ids ) ) { return; } require_once(‘../../../../wp-load.php’); $args = array( … Read more

Array to modify post titles

Your example code could easily be converted to an array, like this: Updated and improved code for your new example: function manipulate_post_title( $title, $post_id ) { $title_array = array( ‘1153’ => $title . ‘-suffix’, ‘2’ => ‘prefix-‘ . $title, ‘3’ => ‘completely different title’, ); if ( is_single() && isset( $title_array[ $post_id ] ) ) … Read more

CPT while loop not working

Your post type is all wrong. Custom post type names cannot contain spaces or camelcase, also names should not contain special characters. Custom post type names, and for that matter, custom taxonomy names should be all lowercase letters, and names must only be separated by underscores (_) Have a look at the $post_type parameter in … Read more

Get latest post from categories

Ok you can use a foreach loop to return the latest post from each category. Here is how you should do that. <?php $postids = array(); $catids = array( 1, 2, 3 ); // add category ids here. foreach ( $catids as $catid ) { $my_query = new WP_Query( array( ‘cat’ => $catid, ‘ignore_sticky_posts’ => … Read more

Multiple meta query from array

$search_term is already an array of an array. When you eventually add that to your meta_query, you get an array of an array of an array, which will not work You are using AND as your relation operator which is the default for a multi-array meta_query. I would suggest that you drop that, and then … Read more

Exclude specific user_id from args in get_comments

Looks like I had to figure this one out myself. replace $comment_meta_args and $replies with global $wpdb; $comment_meta_args=”SELECT * FROM `$wpdb->comments` WHERE `comment_approved` = 1 AND `comment_parent` = (“. intval($parent_comment_id) .”) AND `user_id` != 1 ORDER BY comment_date ASC LIMIT 3″; $replies=$wpdb->get_results($comment_meta_args);

add the value of a variable returned in a while loop [closed]

Try to change with this: …….. …….. …….. $fullcost = 0; while( $connected->have_posts() ) : $connected->the_post(); $cost = get_post_meta( $post->ID, ‘foxware-ingredient-cost’, true ); $fullcost += $cost; echo ‘<li>’; the_title(); // Display cost echo ‘<br>’; echo ‘Cost: ‘ . $cost; echo ‘</li>’; endwhile; echo $fullcost; ?>

Only load certain artists on this page

if you want to show only 2, put it as a value, like so: ‘posts_per_page’ => 2 For the newest posts, you need to change the sort using the order and orderby params: ‘orderby’ => ‘date’, ‘order’ => ‘ASC’ Details about orderby params here: http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters Also, you should avoid the query_posts use. Except if you … Read more