WordPress converting my code

<script> tags go in the document head, not in the document body (or, if in the document body, they should be the very last thing before the closing </body> tag. Besides, if you’re adding code of any sort in your post, you’re going to run into issues if you use the Visual editor, or, more … Read more

Override plugin with functions.php

You can change the name of add_gpp_gallery function both in the callback and in the declaration to avoid the conflict between the original and your clone. Something like this… add_action(‘wp_head’,’jason_add_gpp_gallery’); function jason_add_gpp_gallery() { if ( is_single() && ‘your_post_type’ == get_post_type() ) ){ remove_shortcode(‘gallery’, ‘gallery_shortcode’); add_shortcode(‘gallery’, ‘gpp_gallery_shortcode’); } } … should work for you. Bonus: You … Read more

Problem Building a Simple Google Maps Plugin

Wierd, just re-read your comment and looks like your shortcode is working when you call it that early – if the map-canvas div is showing up. here’s the code I tested, also added jquery as a dependency for your custom script & changed some css on you div… function lax_google_map_init() { wp_enqueue_script(‘google-maps’, ‘http://maps.googleapis.com/maps/api/js?sensor=false’); wp_enqueue_script(‘lax_google_map_script’, plugins_url(‘js/lax_google_map_script.js’, … Read more

wordpress reusable content blocks

One of two ways: Add a shortcode, so someone could drop in [content-block id=”12″] wherever they wanted. Here’s a very simple example without a lot of error checking. <?php add_action( ‘init’, ‘wpse29418_add_shortcode’ ); function wpse29418_add_shortcode() { add_shortcode( ‘content-block’, ‘wpse29418_shortcode_cb’ ); } function wpse29418_shortcode_cb( $atts ) { $atts = shortcode_atts( array( ‘id’ => 0 ), $atts … Read more

Show only preview of posts on the homepage?

Look somewhere after the “Loop” starts (it starts with <?php while( have_posts() ): the_post(); ?>) in your index.php file. Find <?php the_content(); ?> and change it to <?php the_excerpt(); ?>. If you don’t want any content, just remove the_content() all together. If you’re using a theme from wordpress.org, it would best to do this in … Read more

Syntax Highlighting Plugins and 3.2.1

I use SyntaxHighlighter Evolved on my site which is based on Alex Gorbatchev’s SyntaxHighlighter and used by WordPress.com blogs/sites to get something like this: And i just recently published a plugin named Simple Gist Embed This Plugin allows to embed GitHub Gist to your posts/pages/custom using a simple shortcode and even simpler using a built-in … Read more

Auto add content such as pages upon plugin activation?

You can add those without a button: register_activation_hook( __FILE__, ‘my_plugin_install_function’); function my_plugin_install_function() { //post status and options $post = array( ‘comment_status’ => ‘closed’, ‘ping_status’ => ‘closed’ , ‘post_author’ => 1, ‘post_date’ => date(‘Y-m-d H:i:s’), ‘post_name’ => ‘Checklists’, ‘post_status’ => ‘publish’ , ‘post_title’ => ‘Checklists’, ‘post_type’ => ‘page’, ); //insert page and save the id $newvalue … Read more