Articles of plugins

Table is not created in WAMP

I don’t know where the mistake is. My code is not creating a table in WAMP: function subscribe_table() { global $wpdb; $table_name = $wpdb->prefix.’_databasesubs’; $charset_collate = $wpdb->get_charset_collate(); if ( $wpdb->get_var( ‘SHOW TABLES LIKE ‘. $table_name ) != $table_name ) { $sql = “CREATE TABLE $table_name ( sno int(2) NOT NULL AUTO_INCREMENT, email varchar(25), name varchar(25), […]

Deregister scripts from plugin

I have an own class that deregisters all scripts and styles and creates 2 cached files one for scripts and one for styles that is registered in the end. This runs inside theme, my problem is that I cant move it into plugin, as soon as i move it into plugin it wont work. currently […]

How to request admin-ajax.php correctly when wordpress URL and site URL are different?

When site_url() and home_url() are different, how a request should be directed to admin-ajax.php (both in front-end and admin)? Using A. admin_url(‘wp-admin/admin-ajax.php’) or B. home_url(‘wp-admin/admin-ajax.php’) Usually method A is used. However for some websites this request gives error 404 in front-end. Method B does not work when wordpress is located in some sub-directory with respect […]

Get Current user email as a return string value

if(strpos($query, ‘%get_email%’) !== false){ $query = str_replace(‘%get_email%’, get_the_author_meta( ‘user_email’ ), $query); } Okay so am trying to make a MySQL query and in the plugin I am trying to add a shortcode %get_email% but anyway its not returning any email in the actual query. Like select* from from tablename where email=’%get_email%’; Any idea on how […]

how to incude logo in contcat form 7 email

I am using contact form 7 plugin. how to include logo in emails sending to user and admin. I am new in word press.

How do I get a post author's image/avatar via RSS from another blog?

I have 2 websites: one is a company website, the other is a blog for the company – these sites are on separate domains. On the homepage of the company website, there’s a square tile featuring the latest post from the blog, including the blog title (hyperlinked) and the post author’s picture/avatar. To retrieve the […]

Use Plugin Whenever One Exists?

I’m new to WP so I am not confident in my abilities yet. Is it safest to always install a plugin, when available, for whatever functionality I want (as opposed to coding it myself)? For example, I would like the user to be able to filter the posts displayed by tags, category, etc. I have […]

How to render a template file using shortcode inside a plugin

I have this plugin I created that has a custom post type and a template file that renders the posts. I want to be able to render the template in any page using a short code. So what I created was this piece of code which I am sure is wrong and would totally appreciate […]

Is there a way to remove plugins in dashboard – where you cannot identify the slug by the plugins name?

I’m trying to create a generic function that removes menu pages in admin dashboard wordpress. This is my attempt… function remove_menus(){ //Find admin… $admin_url = get_admin_url(); //Find php-files in admin path //and create an array of them $admin_files = array(); foreach (glob(“*.php”) as $file) { if($file == ‘.’ || $file == ‘..’) continue; $admin_files[] = […]

Shortcode Output on Top of the Posts

This question already has an answer here: Shortcode outputs at the top of the_content 3 answers What is wrong with this Shortcode? I get it in a wrong place inside the content 2 answers