Articles of default

How to deal with equal & similar arguments for a function?

I’m currently extending my pagination plugin, after a hint by @toscho. So the plugin will now use the same filters, hooks and arguments as the native wordpress pagination functions. My problem is that the different wp functions name their arguments … different. Example: This is how you change the text for the “Next” link. wp_link_page() […]

Default or Preset Content for Custom Post Types

I am trying to modify the code for default content to display based on post type, but so far I have been unsuccesful. The base code is: add_filter( ‘default_content’, ‘my_editor_content’ ); function my_editor_content( $content ) { $content = “default content goes here….”; return $content; } My modifications include: add_filter( ‘default_content’, ‘my_editor_content’ ); function my_editor_content( $content […]

Setup A Default Featured Image

I’m trying to setup a default fallback featured image on my website to ensure consistency with images being displayed for every post, even when an image is not embedded in the post. I’ve tried a number of plugins – Default Post Thumb and Default Thumb, however neither of these seemed to work. I’m using WP […]

Change Default Image HTML

I am making a WordPress theme and want to change the default image html. For example if you upload an image using WordPress uploader it generates the following html for your images <a href=”image_url_goes_here”> <img class=”aligncenter size-full wp-image-100″ src=”your_src”/> </a> I want to change it to something like this <div class=”image-container”> <img class=”aligncenter size-full wp-image-100″ […]

Why are Shortcodes Disabled in Widgets by Default?

I’ve looked all around but can’t seem to locate a definitive answer for my question: why are WordPress shortcodes disabled by default in text widgets? It’s super easy to enable them, with the line add_filter(‘widget_text’, ‘do_shortcode’), so I’m just curious as to why WordPress doesn’t have that option enabled by default. Is it for potential […]

Woocommerce: Changing the variations select default value?

At my site i want to change the default value of the selecter that appears, when different variations exists. If anyone can give me a clue of how and where this is done, it would be highly appreciated!

Delete pages and Create default pages for all new network sites

I am using the following code to delete some default pages and to also create some default pages for all new sites that are created. It work as is now but that is only because I purposely have a mistake there that whenever I correct, the functions stop working. This is the part of the […]

Default WP search excluding specific characters, is it possible?

I would like to know if it possible to customize the default search module of WordPress. I’ve a website dealing with teams and teams’ news. Some of those teams has their names written like this H.M.S. L.A. Dream N.Y. Invaders I would like that the search modules could be able to manage those teams in […]

Add default content to post (for specific category)

I’m trying to add some default content to my posts using this code in my functions.php: add_filter( ‘default_content’, ‘my_editor_content’ ); function my_editor_content( $content ) { $content = “My html content.”; return $content; } It works fine, but I would like to add the content to some categories only. This is tricky because the default content […]

Is it possible to set default values for custom fields in a custom post type while my plugin is being activated?

I have been developing a plugin that creates a custom post type. The custom post type has many custom fields and I want to set default some values for these custom fields on activation. How can I do this? <li> <label for=”cx_number” class=”sinop”>Post Limit</label> <input style=”width:50px;” type=”number” name=”cx_number” id=”cx_number” value=”<?php if( !empty ( $postData[‘cx_number’]) ) […]