Why doesn’t PhotoSmash plugin play well with wp_query?

There is no need to juggle $wp_query object, store it in temp, etc. It is rarely good idea to directly mess with important global variables, unless you absolutely need to. You can just create your own arbitrary variable and init it with new WP_query $some_variable = new WP_Query($args); and so on. Also don’t forget to … Read more

$_GET[‘updated’] does not work in WordPress 3.1?

This line is wrong, i couldn’t even get the theme options page up without changing it.. add_theme_page( “Satoshi Theme Options”, “Theme Options”, 8, __FILE__, ‘theme_options_admin’); Update that to read something like.. add_theme_page( “Satoshi Theme Options”, “Theme Options”, 8, ‘satoshi-theme-options’, ‘theme_options_admin’); Saving options did produce the updated message as expected. UPDATE: Looks like the $_GET key … Read more

How do you create two separate Register pages?

Basically all you need to do is add an hidden field named role and set the value to whatever role you want on the register form. add_action(‘register_form’,’show_role_field’); function show_role_field(){ ?> <input id=”role” type=”hidden” tabindex=”20″ size=”25″ value= “<?php if (isset($_GET[‘role’])){echo $_GET[‘role’];} ?>” name=”role”/> <?php } Next thing is to register that role when the user has … Read more

How to add drag and drop functionalities to a div inside option panel

3 steps: php <?php wp_enqueue_script( ‘jquery-ui-sortable’); html <div class=”metabox-holder”> <div class=”postbox-container”> <div id=”my_div” class=”meta-box-sortables ui-sortable”> <div class=”postbox” id=”el1″> <h3 class=”hndle”><span>title2</span></h3> <div class=”inside”>content1</div> </div> […elements…] <div class=”postbox” id=”el20″> <h3 class=”hndle”><span>title20</span></h3> <div class=”inside”>content1</div> </div> </div> </div> javascript <script type=”text/javascript”> jQuery(document).ready(function(){ jQuery(‘#my_div’).sortable(); });

Removing the first 8-10 letters from a post?

This is a new query loop that I use that shows the latest ten post titles/permalinks in the category mycategoryname and strips the first 15 characters from all of the titles. <?php $my_query = new WP_Query(‘category_name=mycategoryname&showposts=10’); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <a href=”https://wordpress.stackexchange.com/questions/14120/<?php the_permalink() ?>” title=”Permanent Link to: <?php the_title_attribute(); ?>”> <?php $mytitle … Read more

PHP in Edit Post link

The easiest way might be to use get_edit_post_link() (Codex ref), which returns just the link, allowing you to use it however you need, according to your purposes.