Undefined index: action plugin problem

The logic on line 225 is bad. if( isset($wp_logo_slider_images[‘update’]) == ‘Added’ || $wp_logo_slider_images[‘update’] == ‘Deleted’ || $wp_logo_slider_images[‘update’] == ‘Updated’) { isset($wp_logo_slider_images[‘update’]) is never going to equal ‘Added’ but that isn’t where the error comes in. PHP will try to use $wp_logo_slider_images[‘update’] twice on that line without checking that the value is set. What you need … Read more

Pagination broken on is_front_page()

According to the WP_Query docs: Pagination Note: Use get_query_var(‘page’); if you want your query to work in a Page template that you’ve set as your static front page. The query variable ‘page’ also holds the pagenumber for a single paginated Post or Page that includes the Quicktag in the post content. Display posts from current … Read more

Prev/Next Links Broken on Static Front Page Pagination

previous_posts_link() echos the result of get_previous_posts_link() which checks the paged query variable, not the page query variable used on static pages. You will have to write your own code to display the link on a static page. I didn’t test it, but you might try fooling WordPress: function homepage_test() { global $paged; Now your changes … Read more

Displaying posts based on category

Add category_name or cat in your arguments (args) array. <div id=”mini_stream”> <ul> <? $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => 4, ‘category_name’=>’html’, ); $loop = new wp_Query($args); while($loop->have_posts()) : $loop->the_post(); echo ‘<a href=”‘.get_permalink().'”>’; echo get_the_post_thumbnail($post->ID, ‘category-thumb’); the_title( ‘<h6>’, ‘</h6>’ ); echo ‘</a>’; endwhile; wp_reset_query(); ?> </ul> </div>

Detecting if parent page has gallery

It happens because strpos returns 0 (zero index position) when gallery shortcode is at the start of the content which is treated as false by the if condition. Solution is to use Identical operator === in condition to check if the return value is a boolean false.

Shortcode to find and replace URL

Your shortcode function should look like this: function replace_url_for_nonlogged( $atts, $content = “”) { if ( is_user_logged_in () ) return $content; extract( shortcode_atts( array( ‘replace’ => ‘http://www.default_replace_url.com’, ), $atts ) ); $pattern = ‘/href=(“|\’)((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)(“|\’)/’; return preg_replace($pattern, “href=\”$replace\””, $content); } add_shortcode( ‘scode’, ‘replace_url_for_nonlogged’ ); Then you can use the shortcode like this: [scode]Lorem <a href=”http://reservedurl.com”>ipsum</a> dolor … Read more

Fatal error: Call to undefined function register_new_user()

I greped a 3.6 install and got this: ./wp-login.php:321:function register_new_user( $user_login, $user_email ) { ./wp-login.php:550: $errors = register_new_user($user_login, $user_email); Notice the function definition is in wp-login.php. If you look at the current wp-login.php, it isn’t there anymore and there is a note at the top of the page, just above the code: Last change on … Read more

Adding an option to a shortcode

Regarding Edit #3 I would rewrite it like this: //* Shortcode for getting users function list_of_users( $atts ) { extract( shortcode_atts( array( ‘display’ => ‘all’, ‘user’ => ’30’ ), $atts )); $content=””; switch ( $display ) { case ‘all’: $content = display_all_users(); break; case ‘single’: $content = display_single_user( (int) $user ); break; default: break; } … Read more