Wordpress ajax example Categorías: Código PHP Javascript CMS Wordpress Etiquetas: Wordpress Code PHP Javascript examples AJAX Simple ajax example to show some info every 3 seconds, loading it from php in your plugin or theme functions.php file Javascript Include this code in your theme header.php for example <script type="text/javascript"> Leer más sobre Wordpress ajax example
Wordpress filter general search by post content type only Categorías: Código PHP CMS Wordpress Etiquetas: Wordpress Code examples /** * Filter main search with post content type only * @param object $query * @return object */ function search_filter($query) { Leer más sobre Wordpress filter general search by post content type only
Wordpress create custom page with php Categorías: Código PHP CMS Wordpress Etiquetas: Wordpress Code custom Summary Step 1: create page from WordPress admin and note the url slug Step 2: create a file in your active theme named 'page-url-slug.php' Step 3: load WordPress header and footer in the file Leer más sobre Wordpress create custom page with php
Wordpress custom admin table from database with pagination Categorías: Código PHP Desarrollo web CMS Wordpress Etiquetas: Wordpress Code plugin Objective Create a custom table with data from a database sql query, with sort and pagination, in WordPress admin panel. Step 1: create a custom menu link to access a new page for the table Step 2: create callback function for the menu link, prepare data input for pagination, sort and print form + table Note: this should be improved to use full WordPress advantages of wp_list_table Step 1: create a custom menu link to access a new page for the table Leer más sobre Wordpress custom admin table from database with pagination
Wordpress add link to admin menu bar Categorías: Código PHP Desarrollo web CMS Wordpress Etiquetas: Wordpress Code plugin admin Step 1: call add_action 'admin_menu' Step 2: create custom function for the new link Step 1: call add_action 'admin_menu' add_action( 'admin_menu', 'register_example_custom_menu_link_menu_page' ); Leer más sobre Wordpress add link to admin menu bar
Wordpress disable admin bar for all users except for administrators Categorías: Código PHP Desarrollo web CMS Wordpress Etiquetas: Wordpress Code plugin /** * Disable Admin Bar for All Users Except for Administrators */ function remove_admin_bar() { Leer más sobre Wordpress disable admin bar for all users except for administrators
Wordpress get user role from plugin Categorías: Código PHP Desarrollo web CMS Wordpress Etiquetas: Wordpress Code plugin Method 1: by global $current_user for the current user logged in Method 2: check if an user has a specific role by SQL query Method 1: by global $current_user for the current user logged in /** * Checks if current user has administrator role * @return boolean */ Leer más sobre Wordpress get user role from plugin
Wordpress shortcode example Categorías: Código PHP Desarrollo web CMS Wordpress Etiquetas: Wordpress Code shortcode plugin Step 1: make your own function inside your plugin Step 2: call add_shortcode inside your plugin Step 3: use the shortcode in a text widget Step 1: make your own function inside your plugin /** * shortcode: site url * @return string */ Leer más sobre Wordpress shortcode example
Wordpress make your own plugin multilingual Categorías: Código PHP Desarrollo web CMS Wordpress Etiquetas: Wordpress plugin Code multilingual Summary Step 1: make some string in your plugin translatable Step 2: load the function with add_action 'init' in your plugin Step 3: create folder and file for translations inside your plugin Step 4: update your language files with poedit In the example, we are going to translate the plugin to Spanish. Leer más sobre Wordpress make your own plugin multilingual