Articles of plugin development

Adding content before the loop in category pages

I am creating a plugin and I want to show all sub category list in the top of every category page. I had created a function and call “wp_list_categories” in that function. The problem is when I call that via add_filter(‘the_content’, ‘myfunction’); List of all sub category is return successfully. Before every post and i […]

Loading scripts with wp_register_script and wp_enqueue_script

How could I include the following script and stylesheet in a wordpress plugin if they only need to load in the admin panel? <script type=”text/javascript” src=”/wp-includes/js/jquery/jquery.js?ver=1.11.3″></script> <link rel=”stylesheet” type=”text/css” href=”assets/chosen.min.css”> <script type=”text/javascript” src=”assets/chosen.jquery.min.js”></script>

Error : “Cannot use object of type WP_Post as array in”

Fatal error: Cannot use object of type WP_Post as array in C:\xampp\htdocs\wordpress-4.3.1\wp-includes\query.php on line 3716 I don’t know what is this I am searching from internet but not find the solution

How do I include drag-and-drop in a plugin?

I want to build a WordPress plugin that will allow users to add and delete fields from a custom post type. I want them to be able to do this with drag-and-drop, just like they add widgets to a sidebar. That is to say, the plugin will have a group of allowable fields, and the […]

Some strings from a .mo file do not load

In a plugin I’m developing, most translations do work, but some strings refuse to work without an apparent reason. For a settings page, I’m using this pattern: $clgs_settings_descriptions = array( ‘notification_severity_filter’ => __( ‘Minimum severity for notification in adminstration menu’, ‘custom-logging-service’ ), ‘def_severity_filter’ => __( ‘Default minimum severity filter on log page’, ‘custom-logging-service’ ), ‘manager_role’ […]

Use register_taxonomy() in register_activation_hook()

I would like to use register_taxonomy() to define a hierarchy of geographical terms. It seems that the natural place to place it would be in a function called by register_activation_hook() seeing how the taxonomy needs only to be defined once. However, the fine manual explicitly states to “use the init action to call this function”. […]

override pluggable.php functions

I just not only want to override a pluggable function (wp_new_user_notification) but I want to make sure that if any other plugin is overriding the same function, so my function , override that too or I want my overridden function to work instead of other plugin that is overriding the same function (wp_new_user_notification). May be […]

Retrieve contents/page names of various pages for use in a plugin

I’m trying to design a plugin that retrieves the contents of user selected pages and copy the contents into a giant single page. (As long single page websites are trendy right now) These are the following functions I need to either find or build: Get list of page names in database. Get contents of the […]

This doesnt work for Plugin get_template_directory_uri()

function Zumper_widget_enqueue_script() { wp_enqueue_script(‘jquery-repeater-form’,get_template_directory_uri().’/admin/js/sample.js’); } add_action(‘admin_print_scripts-widgets.php’, ‘Zumper_widget_enqueue_script’); Suppose a javascript is sitting in my wordpress theme in this path- admin/js/sample.js and the theme is using wp_enqueue_script to include this file – wp_enqueue_script(‘jquery-repeater-form’,get_template_directory_uri().’/admin/js/sample.js’); Now my question is if I am transferring the widget and javascript to plugin- widget codes will go in plugin.php file and javascript […]

Modify users.php page to create page/post on button clicked

I am trying to create a new Column in users.php (WordPress Users Page) with buttons. Each button, associated with the user, has to create a page or a post (based on my programmatically selection). I have some problem on how to call the function to create the page/post from inside the class. Here is some […]