Custom functions for string data calculations
Hmm…i might be getting you wrong, but do you know that WP comes with an AJAX callback framework that helps you with this, making calling your own callback file unneccessary?
Hmm…i might be getting you wrong, but do you know that WP comes with an AJAX callback framework that helps you with this, making calling your own callback file unneccessary?
The best solution here is to use the built-in filter for embed parameters: <?php function mytheme_embed_defaults( $defaults ) { return array( ‘width’ => 100, ‘height’ => 100 ); } add_filter( ’embed_defaults’, ‘mytheme_embed_defaults’ ); ?> This code can be added to your theme’s functions.php file and you can change the numbers to reflect the sizes that … Read more
It depends on the source image, aspect ratio is not magic, it must be maintained in order to lessen the proportional distortion. You best option is to upload images that will maintain the same aspect ratio. You can tweak your CSS to get a more consistent image size but be aware that doing so will … Read more
I”d wrap it in a function (save it in functions.php); function wp_list_pages_with_hash( $hash, $args=”” ) { $add_hash = create_function( ‘$link’, ‘return $link . “#’ . $hash . ‘”;’ ); add_filter( ‘page_link’, $add_hash ); $result = wp_list_pages( $args ); remove_filter( ‘page_link’, $add_hash ); return $result; // back compat in case ‘echo’ was null } Then call … Read more
It’s probably better to add your session_start(); to the top of your header.php file if you’re planning to use it in your theme. If you are wanting to use a session in the admin, I’d recommend either passing variables through $_GET or $_POST. Also, if you need long term storage of variables, it’s pretty easy … Read more
The plugin would need to support custom post types. You might be able to ask the plugin developer to add that. The custom post type API’s are fairly new and still don’t have widespread support. You can see that they are adding the meta boxes only for posts and pages: add_meta_box( ‘WPPostsRateKeys-Keyword’, ‘SEOPressor Keyword’, array(&$this,’add_box_in_post_form’), … Read more
You can check for your post type single-{post-type}.php first try this: /* Define a constant path to our single template folder */ define(SINGLE_PATH, TEMPLATEPATH . ‘/single’); /* Filter the single_template with our custom function*/ add_filter(‘single_template’, ‘my_single_template’); /* Single template function which will choose our template*/ function my_single_template($single) { global $wp_query, $post; /* Checks for single … Read more
Use comment_form() not a self made code. See the answers to question 15179 for a working example of a comments.php.
Try this? <?php function get_project_services() { global $post; $data = get_post_meta( $post->ID, ‘project’, true ); $project_services = $data[‘project_services’]; return $project_services; } ?> Then in your template file: <p><?php echo get_project_services(); ?></p> I think that will do what you’re asking? (Edited to match your comment.)
What sort of unique data are returned by your external SQL query? I would assume that you would need to insert some sort of unique data (e.g. primary key from the external DB) as either $post data or metadata, and then your conditional could look for the existence of these unique data. Alternately, you could … Read more