trying to write a variable into a wp_query, need help!

Using get_posts(): <?php $category = get_category_by_slug($post->post_name); $template = $category->term_id; $taskarr = array( ‘post_type’ => ‘listing’, ‘post_status’ => ‘publish’, ‘category’ => $template, ‘order’ => ‘ASC’, ‘orderby’ => ‘meta_value_num’, ‘meta_key’ => ‘listing_date’ ); $tasks = get_posts($taskarr); foreach( $tasks as $task ) { echo ‘<li>’; echo $task->post_title; echo $task->post_excerpt; echo get_post_meta( $task->ID, ‘location’, ‘single’); echo ‘<li>’; } ?> … Read more

Grouped custom taxonomy query

If you need nested queries, first you should think about, which data is needed. In your example you need all terms of a tanonomy as well as all posts belonging to each taxonomy. So the first step should be to find a way to loop through all terms of a taxonomy: /* TAXONOMIES */ // … Read more

Assign classes to Custom fields

I think you have to output these Custom Fields manually to do it. You can do it like so (let’s assume your custom fields are: first-meta-key, second-meta-key, third-meta-key and you set them single value – no field has multiple values assigned to it): <ul> <li><span class=”first-post-meta-key”>Name: </span> <?php echo esc_html(get_post_meta($post->ID, ‘first-meta-key’, true)); ?></li> <li><span class=”second-post-meta-key”>Name: … Read more

Select Menu for Custom post Type does not save

This is a javascript issue. on line 52: $ret .= ‘<script>jQuery(document).ready(function(){ jQuery(“#videotype”).val(‘ . get_video_field(“videotype”) . ‘) });</script></div>’; In this specific bit: .val(‘ . get_video_field(“videotype”) . ‘) The value isn’t quoted, so it’s trying to reference a variable named youtube or vimeo, which doesn’t exist, instead of a literal text value. If you add quotes it’ll … Read more

Set static page as default front page on newly created sites in multisite

Try the following code. Based on these two Q&A’s (not tested): How to add Custom Blog Options to new blog setup form? Programmatically set page_on_front add_action( ‘wpmu_new_blog’, ‘process_extra_field_on_blog_signup’, 10, 6 ); function process_extra_field_on_blog_signup( $blog_id, $user_id, $domain, $path, $site_id, $meta ) { switch_to_blog($blog_id); $homepage = get_page_by_title( ‘Sample Page’ ); if ( $homepage ) { update_blog_option( $blog_id, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)