Applying my own css classes in wp_menus 3?

Do you need to modify walker or hook into it unmodified? Since there is filter provided for that id, it is easy to hook into. Try this: add_filter( ‘nav_menu_item_id’, ‘modify_menu_item_id’ ); function modify_menu_item_id( $text ) { static $myCounter; if( !isset( $myCounter ) ) $myCounter = 0; return ‘menu-item-‘ . ++$myCounter; } Update Changing walker // … Read more

Custom Page Template and Category Exclusion

Try this code in your template. <?php /** * Template Name: Exclude Comic Category */ get_header(); ?> <div id=”primary”> <div id=”content” role=”main”> <?php query_posts( array( ‘category_name’ => ‘comic’, ‘paged’ => get_query_var(‘paged’), ‘posts_per_page’ => 5 ) ); ?> <?php if ( have_posts() ) : ?> <?php twentyeleven_content_nav( ‘nav-above’ ); ?> <?php while ( have_posts() ) : … Read more

HTML in PHP problem [closed]

You get the error because you try to call php inside php. Try to use this snippet and see what is different: <?php if(get_field(‘post_image’)) { echo ‘<img src=”‘. get_field(‘post_image’) .'” />’; } else { echo ‘<img src=”‘ . get_bloginfo(‘template_url’) . ‘/images/images/default.jpg” />’; } ?> Also pay attention that bloginfo immediately prints value, when get_bloginfo returns … Read more

Gallery Pagination by Row

It is definitely possible!! Ok, here is what I did… My new loop looks like: <?php $ids = array();?> <?php foreach(query_posts(“category_name=photos&showposts=-1”) as $post_blog): ?> <?php $url = wp_get_attachment_image_src( get_post_thumbnail_id($post_blog->ID), ‘gallery-full’ ); ?> <?php $thumbs = wp_get_attachment_image_src( get_post_thumbnail_id($post_blog->ID), ‘gallery-thumbnail’ ); ?> <?php list($width) = getimagesize($thumbs[0]); ?> <?php $ids[] = array(“id_post” => $post_blog->ID, “width” => $width, ‘url’ … Read more

Change the behaviour of archive cpt category and single cpt by plugin, not by theme

You can use templates located within your plugin instead of theme files, like so: add_filter(‘archive_template’, ‘redirect_to_plugin_archive_template’); function redirect_to_plugin_archive_template($template) { if(is_post_type_archive(‘my_cpt’)) { return dirname(__FILE__) . ‘/templates/my_archive_template.php’; } } add_filter(‘single_template’, ‘redirect_to_plugin_single_template’); function redirect_to_plugin_single_template($template) { if(is_singular(‘my_cpt’)) { return dirname(__FILE__) . ‘/templates/my_single_template.php’; } } Obviously you need to change the custom post type slug and the template paths, but … Read more

WordPress Search on Multiple wp sites

You’ll need to have a look at the posts_clauses filter. There’re more specialised filters as well like posts_where, but you’ll finally end up using the all in one filter. Then you can inspect the outcome using the ‘posts_selection’ hook right below that, or the posts_results filter a bit later on. There’s as well the posts_search … Read more

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