Category: Wordpress
-
WordPress – How to add reset button in theme options page?
Last updated:
I was working on a wordpress theme project, where i implemented theme options page. Thought that there needs to be a feature to reset all theme values, when a button is clicked. It didn’t work, when i put-up a Reset button, near the submit button on the same form in the wordpress. It turns out…
-
Softlights – Free wordpress theme with unlimited colors
Last updated:
Softlights is a fully customizable wordpress theme with unlimited colors through color picker, ideal for content hungry websites. It is simple, easy to use theme and doesnt dazzle you with setting hundreds of theme options. Pick the colors you want for header, background, footer, widgets, showcase box and go live within a minute. The theme…
-
WordPress – How to save default values in theme options page?
Last updated:
If you are a wordpress plugin or theme developer, when creating a theme options page, have you ever wondered why you get Notice: undefined index warnings, thrown by the wordpress debugger. This because when you activate the theme, there is absolutely no values initialized (not even empty values). I am assuming that you are storing…
-
WordPress – How to remove the dots in excerpt endings?
Last updated:
By default wordpress, automatically adds the […] to while clipping the excerpt extra data. This you will notice in the homepage when the blog posts show up. Personally, i dont like this and i always fix this by replacing [..] to something like either remove it or with couple of dots. Here is the snippet…
-
How to replace strings or tags inside content in WordPress?
Last updated:
With wordpress is pretty easy to filter and replace tags that occur inside the content. Lets say you have the content with <php> tags and want to replace it as <pre> tag. All you need to do is write a filter in your theme file <strong>function.php</strong> ,that finds and replaces all occurrences of php tags, which is so…
-
How to include php files in wordpress?
Last updated:
Any good theme or plugin developer would break the theme files into small ones and then included them as and when needed. This way you you save yourself from the cumbersome job of editing each and every php file. But, how you do you include the php file, the correct way in wordpress. If you…
-
How to add jquery to WordPress theme?
Last updated:
WordPress uses jquery by default and you dont have you do anything extra, most jquery scripts and plugins should pretty much work well by default. so, how to add jquery the correct way? Its easy and can be done with just 3 lines of code and can be done in a couple of ways.Go to…
-
How to list posts for every category in WordPress
Last updated:
If you are building a news site or a directory based theme, you might like to print all categories and then output 10 recent posts in every category, through the use of the loop. Here is the snippet of the wordpress code, that does that. Basically its a double loop, first loops through all categories,…
-
Setting default values to options fields array in WordPress
Last updated:
Lets say you are working on a plugin/theme having numerous option fields in admin setings, but you want to initialize them with default values. Not setting them with default values, can lead the wordpress debugger to throw, undefined index which is nasty. Careful that you are not storing the values in database, but only in…
-
How to dynamically change stylesheet colors in WordPress
Last updated:
Lets say you are implementing a color picker in wordpress options page, but you want to dynamically change colors or background for your header, menu or a link. Here is how to do it correctly and its unbelievably simple in wordpress. Just add a hook to wp_head and look at the code snippet below. function…