This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function post_word_count($post_id) { | |
| $content = get_post_field( 'post_content', $post_id ); | |
| $word_count = str_word_count( strip_tags( strip_shortcodes($content) ) ); | |
| return $word_count; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function post_word_count($post_id) { | |
| $content = get_post_field( 'post_content', $post_id ); | |
| $word_count = str_word_count( strip_tags( strip_shortcodes($content) ) ); | |
| return $word_count; | |
| } | |
| add_filter('manage_posts_columns', 'wordcount_column'); | |
| function wordcount_column($columns) { | |
| $columns['wordcount'] = 'Word count'; | |
| return $columns; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter('manage_posts_columns', 'add_column_middle'); // Register filter | |
| function add_column_middle($defaults) | |
| { | |
| $new_columns = array(); // Create empty array to store new column order | |
| foreach ($defaults as $key => $value) | |
| { | |
| $new_columns[$key] = $value; // Add columns to new array | |
| if ($key == 'title') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Only declare the function if it doesn't exist (prevents PHP fatal error) | |
| if (!function_exists('product_post_type')) | |
| { | |
| function product_post_type() // Function to register new custom post type | |
| { | |
| // Labels used inside the WordPress CMS | |
| $labels = array( | |
| 'name' => _x('Products', 'Post Type General Name', 'text_domain'), | |
| 'singular_name' => _x('Product', 'Post Type Singular Name', 'text_domain'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Create posts in WordPress from data in a MySQL database. Full article at: http://imelgrat.me/wordpress/bulk-upload-custom-posts-wordpress/ | |
| //Load WordPress functions and plug-ins. Put correct path for this file. This example assumes you're using it from a sub-folder of WordPress | |
| require_once ('../wp-load.php'); | |
| $database['hostname'] = 'SERVER'; | |
| $database['username'] = 'USER'; | |
| $database['password'] = 'PASSWORD'; | |
| $database['database'] = 'DATABASE'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * @author Ivan Melgrati | |
| * @copyright 2018 | |
| */ | |
| /** | |
| * Easy fix to remove 'hentry' from the post_class() list | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * @author Ivan Melgrati | |
| * @copyright 2018 | |
| */ | |
| function YouTube_Check_ID($videoID) | |
| { | |
| $is_valid = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.ajax(URL, { | |
| success: function(data) { | |
| // Do something with the returned data | |
| }, | |
| error: function() { | |
| //Handle error here | |
| } | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * AppConfig and Cordova. | |
| * | |
| * Getting EMM configuration data with the "Cordova Plugin for EMM App Config". | |
| * Callback for "deviceready" event. | |
| * | |
| * @link https://imelgrat.me/phonegap/appconfig-cordova-emm/ | |
| * @author Iván Melgrati. | |
| */ | |
| function onDeviceReady() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "ios": { | |
| "release": { | |
| "buildFlag": [ | |
| "-UseModernBuildSystem=0" | |
| ] | |
| }, | |
| "debug": { | |
| "buildFlag": [ | |
| "-UseModernBuildSystem=0" | |
| ] |