Articles of plugins

Use plugin multiple times

I have a site for a booking agency for entertainers. Each entertainer has their own page. The sidebar currently contains the advanced twitter profile widget for the agency’s twitter account. Each of the entertainers’ pages needs the same widget in their sidebar with their own account id. Question is: Is it possible to use the […]

Can't get title of latest post

I’ve just started learning PHP/Wordpress yesterday – here is one of my first plugins. Unfortunately, it’s not working like it’s supposed to – the title doesn’t display. What’s wrong with my code? function show_title_on_dashboard() { $newest_post_id = $post[0]->ID; $title = $newest_post_id->post_title; echo “Latest Post: $title”; } add_action(“admin_notices”, “show_title_on_dashboard”);

Error handling a plugin with exceptions

I’m creating a new plugin and I want to handle errors cleanly. I find the WP_Error class unwieldy so have decided to use exceptions. I am not bothered about lack of PHP 4 support. $error = true; if ($error) { // Throw an error throw new CustomException(‘A custom exception’); } What I really want to […]

Remove Widgets in Dashboard

Another noob question…when authors log on and access their Dashboard, they see all sorts of widgets such as an Internet Explorer warning, news on what’s going on with WordPress. Is there anyway to remove all of these for all users (present and future), so that they only see the ‘Quick Press’ & ‘Right Now’ widgets? […]

How to replace or display the special characters from JSON API plugin

I started using the JSON API plugin. It works good ! But the problem i am facing is, If i enter any text containing special characters through CMS The output is not same as the given text. Why this is happening? Example: It’s a good app (Input) The output looks like It ' s a […]

Problem with wp_enqueue_scripts in plugin

I’ve created the following plugin which requires a js library, however attempts to load the plugin with the line add_action( ‘wp_enqueue_scripts’, ‘calc_script’ ); in place fail with the error unexpected T_STRING any help appreciated. <?php /** * Plugin Name: NME Savings Calculator * Description: A widget that displays the potential savings from installing solar panels. […]

How can I list recent posts excerpts?

I am using this directly from the codex to list 3 recent articles titles. <ul> <?php $args = array( ‘numberposts’ => ‘3’); $recent_posts = wp_get_recent_posts( $args ); foreach( $recent_posts as $recent ){ echo ‘<li><a href=”‘ . get_permalink($recent[“ID”]) . ‘” title=”Look ‘.esc_attr($recent[“post_title”]).'” >’ . $recent[“post_title”].'</a> </li> ‘; } ?> </ul> This works fine however, when I […]

Change post permalink to external URL from custom field

I want to let my users submit links to my website something like reddit and digg. I added a meta_key ‘syndication_permalink’ which contains link to this post. How could I change the post permalink to link this custom link not to my page?

WooCommerce: VAT on grouped products

I’m new to WooCommerce and I have the problem that grouped products always show the default VAT because I can’t change the tax setting on the grouped products. The simple products combined by the grouped one have the reduced rate. So I probably have to change the output in my (sub-)theme to the VAT of […]

Setting Custom Email From name and email address in wp_email()

I am writing a custom plugin that sends an email to users from admin/front end section. I am using wp_email() to send emails and emails are being sent fine. I am testing this on a plain WP installation with only my plugin installed and hostgator as my hosting server. Whenever the email is sent, the […]