Add Paypal Button programmatically

You can create a custom template in the theme that displays the ‘products’ custom post types (see the section on Template Files in Custom Post Types). Then code the HTML for the Paypal button in to your specific single-{posttype}.php and have the attributes such as price, etc, coming from custom fields. <form target=”paypal” action=”https://www.paypal.com/cgi-bin/webscr” method=”post”> … Read more

$wpdb query a post type within a specific taxonomy term while ordering posts by custom meta value?

You have a typo in orderby, and meta_value_num is only used as an orderby value, try this: $args = array( ‘post_type’ => ‘event’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘locations’, ‘field’ => ‘id’, ‘terms’ => $location // location term id ) ), ‘meta_key’ => ‘event_date’, // this meta field stores event date in yymmdd format … Read more

Loop to display random posts only if a custom field matches category

Something like this should be the query you want to run, it adds a condition to the page query that requires the value in “meta_field” to equal the current category’s title. global $wp_query; $args = array(‘meta_query’ => array( array( ‘key’ => ‘meta_field’, ‘value’ => single_cat_title(“”, false), ‘compare’ => ‘=’ ) ) ); query_posts(array_merge($wp_query->query, $args)); // … Read more

Buddypress Add unserialized Profile Fields in Members Loop [closed]

I believe xprofile_get_field_data is unserializing the data for you, but it is still in an array. xprofile_get_field_data can return an array or a comma-separated string. xprofile_get_field_data( $field, $user_id = 0, $multi_format=”array” ) @param string $multi_format How should array data be returned? ‘comma’ if you want a comma-separated string ‘array’ if you want an array

Creating a custom menu/widget area

I’m going to assume you’re using Twenty Eleven theme, or another theme that supports child themes. If you’re using a custom theme, then you can just edit the existing Functions.php and add your additional functionality there, and then edit the existing Style.css. However, if your situation is different, please post back, and I’ll update to … Read more

Save an array from drop-down in custom meta box

Quite simple. Instead of saving the post title, save the post ID, so in the front end you can extract all necessary info. Like so: get_post( $the_saved_ID_value ); or get_permalink( $the_saved_ID_value );. In you code, change this line: echo ‘<option value=”‘.get_the_ID().'” ‘.$is_selected.’>’.get_the_title().'</option>’; Notes: Using a WP_Query seems a bit too much, consider get_posts. Lots of … Read more