Articles of functions

May i Use ShortCode in Template?

Am Using WordPress Blog.Here i want Use Tweetmeme Plugin.I want to show the output of the Tweetmeme Plugin to Customizing place(Side of the Post[Not Before or After]).The Plugin Creators are providing Shortcode.Shall i Use this shortcode in Template?I Guess this is not possible.So we need to change Shortcode as a function.How to Create a function […]

write in functions.php

i just want this code to be added in my functions.php, so that it will directly display after my post ends currently i am adding this code to my single.php, but i want to add this is in functions.php, this code is use to fetch all the tweets of the respective account, the code is […]

How to include local menu based on page id?

I am creating different pages, using templates. For example: page-blog.php. For certain group of pages, I would like to include a local navigation. If I use page.php I am able to include the local nav by checking the id: if(is_page(array(18,52,22,20))) { // code } But once I use a template for the page this does […]

Custom excerpt function re-factoring

This may be more of a php best practices question, but here goes… I am using a custom excerpt trim function: function new_wp_trim_excerpt($text) { // Fakes an excerpt if needed global $post; if ( ” == $text ) { $text = get_the_content(”); $text = apply_filters(‘the_content’, $text); $text = str_replace(‘]]>’, ‘]]&gt;’, $text); $text = strip_tags($text, ‘<p>’); […]

Display gallery on top before content

Is it possible to execute the gallery shortcode before any other content no matter where the shortcode is in the post HTML?

If search results empty then execute certain code

If search results are empty then I want that some code be executed, but how to write such situations programmatically? If !is_search() { certain code } But above doesn’t work.

trying to use wp_handle_upload with ajax

I’ve used this tutorial to build an option page form with Ajax. Now, i want to use the wp_handle_upload to upload an image. i tried this http://pastebin.com/35HW8RSZ but with no success. help will be appreciated. Asaf.

Problems with removing admin bar

I am trying to remove the admin bar from a theme front end of a theme. I found the following code block: add_filter( ‘show_admin_bar’, ‘__return_false’ ); remove_action( ‘personal_options’, ‘_admin_bar_preferences’ ); Which works fine. However I wanted to add a choice for the user, so that I can add a permanent code block to my boilerplate […]

How would I create a shortcode to display a custom post within a page or regular post?

I would like to create a shortcode that will extract information for a custom post, and display it within a Page or regular Post. Specific use case: I have a custom post type “Film” for a film festival website. The films are displayed with their own single-film.php, but occasionally the site owners want to write […]

Missing argument 3 for wp_register_sidebar_widget()

I installed the Deprecated Calls plugin and it’s telling me to change register_sidebar_widget() and register_widget_control(), essentially add wp_ first. I did but I’m getting Missing argument 3 for wp_register_sidebar_widget() and wp_register_widget_control() Is it ok if I put the default none for the 3rd arg?