Use of IF statement in Header file

As Maruti Mohanty mentioned you might not be using get_template_part in the correct way. The first argument is the slug name for the generic template. The second argument is the name of the specialized template. So currently your code is doing the following: On the page that has the ‘custom-page’ slug, display the template part … Read more

Using php inside javascript [closed]

If you want to re-instantiate your countdown timer only after the date has been changed and saved, then, something to the effect of: //In your custom.js file…. //make sure your localized data is a dependency of your custom.js file so you have proper scope to local data jQuery(document).ready(function($){ var date, gapinvite; date = $(‘input[name=”director_date”]’); if … Read more

How to echo the_title from an array of posts?

try to use get_posts instead , as I read in http://codex.wordpress.org/Function_Reference/query_posts you can use this code: global $post; $args = array(‘posts_per_page’ =>3,’category’ => 3 ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); the_title() endforeach; wp_reset_postdata(); Regard’s.

Remove Post if Advanced Custom Field is checked to fix paging

Use WP_Query instead, and you can use the meta_key / meta_value parameters: <?php $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $args = array( ‘cat’ => 10, ‘paged’ => $paged, ‘posts_per_page’ => 12, ‘post_status’ => ‘any’, ‘order’ => ‘ASC’, ‘meta_key’ => ‘archived’, ‘meta_value’ => ‘true’ ); $posts = new WP_Query($args); ?> <?php while($posts->have_posts()): $posts->the_post(); ?> <?php … Read more

Get All In One SEO Pack to use custom field instead of Content

You can not specify which field, but you can use the filter *aioseop_description* to do whatever you want with the description before presenting. So technically, you can use your custom field as follows (untested) : add_filter(‘aioseop_description’,’my_custom_description’); global $post; function my_custom_description($text) { $mycustomseo = get_post_meta($post->ID, ‘my_custom_field’, true); return $mycustomseo; } Replace *my_custom_field* with your custom field. … Read more

How can i make a search box to search by custom field

The generated SQL for that query is going to look something like: SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) INNER JOIN wp_postmeta AS mt1 ON (wp_posts.ID = mt1.post_id) INNER JOIN wp_postmeta AS mt2 ON (wp_posts.ID = mt2.post_id) WHERE 1=1 AND wp_posts.post_type=”post” AND (wp_posts.post_status=”publish”) AND ((wp_postmeta.meta_key = ‘culoare’ AND CAST(wp_postmeta.meta_value AS … Read more

Ajaxurl suddenly not defined

take a look here: http://codex.wordpress.org/Function_Reference/wp_localize_script First add Data in your php file // Register the script first. wp_register_script( ‘some_handle’, ‘path/to/myscript.js’ ); // Now we can localize the script with our data. $translation_array = array( ‘some_string’ => __( ‘Some string to translate’ ), ‘a_value’ => ’10’ ); wp_localize_script( ‘some_handle’, ‘object_name’, $translation_array ); // The script can … Read more

how to add a div inside wp_page_menu

The question is light on detail but I’d lean toward a custom Walker: class My_Page_Walker extends Walker_Page { function end_el( &$output, $page, $depth = 0, $args = array() ) { $output .= ‘<span>After the Anchor</span></li>’; } } $args = array( ‘walker’ => new My_Page_Walker ); wp_list_pages( $args ); That should insert content just before the … Read more

Deactivate a plugin on wp version

The problem is not version_compare, the problem is that register_activation_hook is just a shortcut for add_action( ‘activate_’ . $file, $function ); where $file is plugin_basename( __FILE__ ); and __FILE__ is your main plugin file absolute path. So, what your code does is to call dw_deactivate_theme_options() when the action ‘activate_’ . $plugin is fired. But this … Read more