Skip to content

Tag: wordpress

How can I call a WordPress shortcode within a template?

There’s a plugin for the Contact us form. To activate the form, all you have to do is to place [CONTACT-US-FORM] in the page… My page is calling a page template. Is it possible to add the [CONTACT-US-FORM] shortcode in the PHP template? I tried it and it did not work. The WordPress page worked, bu…

Force WordPress to ignore the w url parameter

Say, I have a WordPress installation running at example.com and have the following url http://example.com/blah?w=100 Now, I want WordPress to ignore the w=100 part because, every time I pass a numeric argument to w, WordPress redirects me to the single page, I assume this has something to do with Attachments.…

Plugin content always on top of post WordPress

I’m trying to make a WordPress plugin. Well, actually it’s done and fully working, except one thing. I have added a shortcode for the plugin. But no matter where in the content I call this shortcode, the contents it gets are always on top of the post, instead of where I placed the tag. The code th…

Add attribute to wp_get_attachment_image

I’m trying to add an attribute to the result of wp_get_attachment_image. I want to use jquery lazyload to handle loading of my post thumbnails and to do that I need to add a data-original= attribute to the <img> tag wp_get_attachment_image is creating. I’ve tried: But it doesn’t add th…

Display WordPress Site Title

I want to display the Title of my WordPress Site on the single blog posts pages. I use the following line of code in my theme’s ‘single blog post.php’ However it does not show anything. Answer You are not outputting anything to show. You are only assigning blog name to a variable. You need t…

AJAX function in the widget class

I created a WordPress Widget which get the recent posts, first get a specific number of posts, then there is a button to get more posts by AJAX. The full Widget code And this is the AJAX code to get ajaxloadMore function output and append to the ul tag How to get $catid and $number variables from the function…

SQL Export – WordPress plugin DEV

Hi So i have the following code.. Now, it works but doesnt download the file. Saying headers already sent. headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/~/wp-admin/includes/template.php:1642) Now i understand that the headers have been sent from my main plugin file already t…

How to Load Ajax in WordPress

I’m familiar with using ajax in the ordinary way with jQuery. I’ve played around it for a while, but don’t understand what WordPress needs to get it to work… What I have here is taken from some …