Articles of plugin development

Create dynamic page content from custom WordPress plugin page

I would like to create a custom WordPress page from a plugin displaying content that is not from WordPress with 2 get parameters and apply rewriting rules on it. Let’s say I have a file called test.php. I would like with 2 get parameters to display content using the URL: I’m good on the […]

Calling a save function from a “submit” button

I am trying to call a function to save changes from a submit button, but I am not accustomed to PHP programming, as I have just started. I tried Googling around a bit, but didn’t find anything too useful or applicable to my situation. At the bottom of my script, I have this function which […]

Add post type pages with plugin

Can I add the archive and single page for a custom post type added by my plugin? I know it will only have to be a best guess with contents like: <?php get_header(); ?> <h2><?php _e(‘My Post Type’, ‘my-slug’); ?></h2> <?php //get posts and list ?> <?php get_footer(); ?> Which would mean it would need […]

How to overwrite iris color pallates from theme to plugin

I am working n plugin for iris color pick and in plugin I want to make my own color pallets and overwritten on iris color picker that use in theme. I create 6 fields in plugin where user can put their color hex codes and when user save them, then they overwritten automatically on pallets […]

Include a php file from another plugin

Inside one of small custom plugins I really need to inlcude a file from another plugin, in order to be able to create and save obhect of a class that is declared there. What I have tried and the closest is this: include_once($plugin_url.’plugin-name/classes/event.php’); The error I get in the debug logs is the following: PHP […]

Is there a better way of handling AJAX requests in WordPress?

I’m currently building a pretty straightforward plugin, but it relies quite extensively on AJAX requests. I’m using the standard admin-ajax endpoint for the requests, but I find that it seems to be massively inconsistent, sometimes the request (for the same data) will take a few hundred milliseconds and then sometimes take a couple of seconds. […]

is it possible to hook every page style?

I’m trying to change the stylesheet for specific page/post while viewing in frontend, but I can’t find the hook or filter for doing that .. I’ve tried many hooks and pages and it doesn’t work Should I use page_css_class ? apply_filters( ‘page_css_class’, array $css_class, WP_Post $page, int $depth, array $args, int $current_page )

Get images / media attached to a page by page ID

I have a series of pages which have images included on them by means of the HTML editor in the admin area. I need to access these while NOT on the the actual page in question, i.e, I need to access these images by the page ID. I’ve tried using the following: $all the images […]

how to Include json manifest file in wp plugin

I want to include a json manifest file in wordpress plugin but don’t know how, this is the file that i want to include in my plugin with rel=manifest and href=manifest.json <link rel=”manifest” href=”/manifest.json”> How to do this in plugin ?

move some files of plugin to the website root directory with plugin activation

I want to move some files of the plugin to the root directory of the website after plugin activation. How can I do this?