Perform internal redirect in WordPress?
Perform internal redirect in WordPress?
Perform internal redirect in WordPress?
A general note: A lot of things in WordPress can be configured. For example the name of the wp-content directory. The same goes for the name of the plugins and themes directory. And both can have multiple folders (with plugins defining them). About child themes and plugins: A plugin and a theme is (in general) … Read more
You need to capture the attributes that passed to a shortcode. You can do that like this add_shortcode(‘testimonial’, ‘testimonial_shortcode_func’); function testimonial_shortcode_func( $atts ) { $atts = shortcode_atts( array( ‘style’ => ‘default_value_if_no_value_is_provided’, ), $atts ); if( $atts[‘style’] == ‘fancy’ ) { //do something } else if ( $atts[‘style’] == ‘something_else’ ) { //do something } //And … Read more
How to remove custom post type and add category and post name
Automatically populate title field
Doing anything without a “page-load” most definitely requires Javascript because your now venturing into the A-Synchronous (AJAX) territory and JQuery is a great library to use for this stuff. The most simple and straight forward of which is the $.post(…) method. You could then attach this send and receive AJAX call to either a shim … Read more
It looks like a couple of things are out of order. First, I’d definitely make sure to declare the $post global It’s also probably worth wrapping your logic in an is_single() and/or is_singular() checks Last, the section where you’re calculating the time as greater than 2 weeks, the current time and post date are switched. … Read more
As per WP Code Snippet blog, it looks like this is one way: Add this code snippet to your functions.php file. // add async and defer to javascripts function wcs_defer_javascripts ($url) { if (strpos($url, ‘.js’) === FALSE) { return $url; } if (strpos($url, ‘jquery.js’)) { return $url; } return “$url’ async onload=’myinit()”; } add_filter(‘clean_url’, ‘wcs_defer_javascripts’, … Read more
One of the things that confused me when using ajax was that die() is necessary at the end of the ajax callback function. Another issue is with the path(s) If you use get_template_directory_uri() and you use a child theme then you get the parents folder. If you use get_bloginfo(‘stylesheet_directory’) and you us a child theme … Read more
Did you create wp-plug-in/wp-plug-in.php file in plugins folder and added this following code. <?php /** * Plugin Name: Load FontAwesome * Version: 1.0 */ /* Exit if accessed directly */ if ( ! defined( ‘ABSPATH’ ) ) exit; function wp_styles() { wp_register_style( ‘font-awesome’, plugins_url( ‘wp-plug-in/css/font-awesome.min.css’ ) ); wp_enqueue_style( ‘font-awesome’ ); } add_action( ‘wp_enqueue_scripts’, ‘wp_styles’ ); … Read more