Articles of plugin development

Custom CSS not being added by plugin

I am attempting to add custom css through my plugin. I do have wp_head() called in my header. My code is – /** * Enqueue plugin style-file */ function prefix_add_my_stylesheet() { wp_enqueue_script(‘style1’, plugins_url(‘style1.css’, __FILE__) ); } add_action( ‘wp_enqueue_scripts’, ‘prefix_add_my_stylesheet’ ); I can access style1.css when I echo plugins_url(‘style1.css’, __FILE__); So I know it exists and […]

What happens if I delete all the rows that represents a post revision from the posts table into WordPress database?

I have the following doubt related to the posts table of the WordPress database. I see that when I create a new post in this table are automatically created 2 new rows. 32 1 2014-08-16 15:07:22 2014-08-16 15:07:22 TEST REVISION TEST REVISION inherit open open 31-revision-v1 2014-08-16 15:07:22 2014-08-16 15:07:22 31 http://localhost/wordpressAsper/2014/08/16/31-revi… 0 revision 0 […]

Plugin can't be activated

I’m developing a WordPress plugin, but the last changes caused the plugin to stop working. It tells me that I can’t activate the plugin because it caused a fatal error. On localhost all is working fine, but after sending to the server, on activation it displays the following: Can’t use function return value in write […]

Removed jQuery script from header.php , any problems?

To avoid multiple jQuery calling from my theme and plugins, I removed <script language=”javascript” type=”text/javascript” src=”<?php bloginfo(‘template_url’); ?>/javascripts/jquery.js”></script> . Now my slider plugin starts working fine in the front end. I don’t know whether it will it cause any problems to my website in future ? Any suggestions.

Don't load the theme for a page FROM a plugin EDITED

I’m developing a pseudo admin area for my client and they don’t want the theme overlaid on it, rather have their admin area take up 100% of the page. Normally I would add if (!is_page($id)) and be done with it however this admin area is part of a plugin that will be used on multiple […]

Ajax +wordpress onClick link redirect to new page and create html content

i have two pages in my wordpress plugin index.php charts.php in index.php i have some content and some link.. <a onclick=”show_trend()” >Trend</a> while clicking this link ,i have an ajax function to create content in charts.php(i dont know if it is correct way) function show_trend() { var data =”action=render_admin_charts_page”; jQuery.ajax({ type: “POST”, url: “../wp-admin/admin-ajax.php”, data: […]

How to avoid conflict of plugin style and theme style?

I have used twitter bootstrap to my plugin. But after install the plugin, it is changing style of the theme that has already bootstrap. How can i avoid this conflict?

Plugin generated unexpected output – No PHP errors

I’m creating a plugin that creates a custom post type I’m working on. I followed this tutorial. I have just changed it from movie_reviews to staff members. I don’t get any syntax errors in PHP and it all looks alright, but when I activate the plugin in WordPress it says it generated 3 characters of […]

Plugin settings are saving but the fields

I’m following @Otto’s tutorial on Settings API. I managed to save the plugin settings into the options table, but by any means can’t save any fields. <?php /** * Add Settings SubMenu * Thanks to: Otto * Following: http://ottopress.com/2009/wordpress-settings-api-tutorial/ */ function plugins_settings_page() { add_submenu_page( ‘my-page-slug’, //$parent_slug ‘Plugin Settings’, //$page_title ‘Plugin Settings’, //$menu_title ‘manage_options’, //$capability ‘plugin-settings’, […]

How to make a cronjob type plugin

Hi i am new on wordpress and has been given a task to make such a script that will fetch posts by categories and shoot email to subscribers. The table structure for subscriber is below Subscriber Id – primary key Subscriber email – varchar Category Id – int Now the task is to fetch post […]