Using wp_get_image_editor in a standalone script

Turns out I’m just silly. WP_Error was the undefined method, not resize. I was sending a bad image location through the resize function. How silly of me! It was working all along. I’ve included this on top $parse_uri = explode( ‘wp-content’, $_SERVER[‘SCRIPT_FILENAME’] ); require_once( $parse_uri[0] . ‘wp-load.php’ ); and this is my image resize function … Read more

Adding a custom line of text to php code

In the insert_posts function, before the line $post_id = wp_insert_post( $post ); add the following (and suit to your needs): Link to Twitter User Page $post[‘post_content’] .= ‘<a href=”http://twitter.com/__USERNAME__”>’ .’Follow me on Twitter’ .'</a>’; and/or Link to Twitter Status $post[‘post_content’] .= ‘<a href=”‘.$post[‘twitter_permalink’].'”>’ .’View this post on Twitter’ .'</a>’;

wordpress custom post type remove duplicate menu item

Just added ‘all_items’ => __( ” ), in labels array. Replace your code with below code register_post_type(‘news’, array( ‘labels’ => array( ‘name’ => __( ‘News’), ‘singular_name’ => __( ‘News’), ‘add_new’ => _x( ‘Add New News’, ‘News’), ‘add_new_item’ => __( ‘Add New News’), ‘edit_item’ => __( ‘Edit News’), ‘new_item’ => __( ‘New News’), ‘view_item’ => __( … Read more

WordPress plugin installation

Add this code and replace yourpagename with the your page slug on which u want this filter to execute function my_name( $content ) { global $post; if ( $post->post_name == ‘yourpagename’ ) { return $content; } } add_filter( ‘the_content’, ‘my_name’ );

WP-Members redirect if member ALREADY logged in

I assume because the function is not called until someone logs in. That is correct. wpmem_login_redirect is a filter that happens when a user is actually logging in. If they are coming to the site and, due to having a valid cookie, are in a logged in state, they will not be redirected. From a … Read more

Edit category output

You will need to use style parameter to define the type of list. And to remove <br /> tags from the list, set parameter ‘echo’ => 0 and str_replace to remove <br /> tag from the output. $args = array( ‘orderby’ => ‘name’, ‘show_count’ => 0, ‘pad_counts’ => 0, ‘hierarchical’ => 1, ‘taxonomy’ => $tax, … Read more

Widgets not showing in my custom theme

You’re using the widget name and not i.d which is why it isn’t working. Change this: if (is_active_sidebar( ‘My_Widgtet_Area’ ) ) : ?> <div id=”widget-sidebar”> <ul> <?php dynamic_sidebar( ‘My_Widgtet_Area’ ); ?> </ul> To this: if (is_active_sidebar( ‘partner-slide’ ) ) : ?> <div id=”widget-sidebar”> <ul> <?php dynamic_sidebar( ‘partner-slide’ ); ?> </ul> The i.d in the template … Read more