Get the current page in a call back function

You need the protocol, the host name and the (root relative) request URL. Then stick them together: $scheme=”http” . ( is_ssl() ? ” : ‘s’ ) . ‘://’; $url = $scheme . $_SERVER[‘HTTP_HOST’] . $_SERVER[‘REQUEST_URI’];

Show latest and related articles from 3 different blogs

@franp. is correct, but in case you want to go a code route here’s how you get an RSS Feed of a website. You can duplicate this as you see fit, or combine multiple into an array etc. Let’s get our RSS Feed from ABC.com $rss = fetch_feed(‘http://abc.com/feed’); // Or where ever that websites feeds … Read more

Allow a role to edit one specific plugin

To solve this you need to go into the main .php file for the plugin and have changed the required capability using add_menu_page. I created a custom capability, added it to Contributors, and changed the .php file to allow users with that capability to view the menu.

Add a header widget to the twentyfourteen theme?

Each theme has different “Widget areas”, so if the theme you are using doesn’t have the one you would like, there are unfortunately not so many options. Or at least, not without editing the template files. I found this plugin: https://wordpress.org/plugins/custom-widget-area/ which seem to do what you need, although it hasnt been updated in a … Read more

How to activate the child theme in WordPress?

All the information you need can be found here: https://codex.wordpress.org/Child_Themes The important parts to get it up and running would be to: Make sure the parent theme exists (the complete accesspress-lite theme in your case) Create a unique folder name for your child theme. Create a style.css file in your child theme folder. /* Theme … Read more

wp_editor() in content that was loaded with ajax [duplicate]

Solution: Add wp_editor() in somewhere that works perfectly and hide it. <div class=”hidden-editor-container” style=”display:none;”> <?php wp_editor( ”, ‘editor’ ); ?> </div> after that assign editor contents to the global JS variable. EDITOR = $(‘.hidden-editor-container’).contents(); Finally when the ajax page is loaded append editor contents $(‘.editor’).append( EDITOR ); tinymce.execCommand( ‘mceRemoveEditor’, false, ‘editor’ ); tinymce.execCommand( ‘mceAddEditor’, false, … Read more

Primary Taxonomy for Post

This post is super old but I’ll post my solution here in case anyone else stumbles across this. If you’re using Yoast SEO you can hook into their existing implementation (they do this already for categories). function add_variety_primary_term_taxonomy( $taxonomies, $post_type, $all ) { if( $post_type == ‘product’ && isset( $all[‘my_custom_tax’] ) ) { $taxonomies[‘my_custom_tax’] = … Read more