I need to add a custom “cover” to every new post — plugin or custom setup?

I’m creating a site that’s basically like an online book, and every post is a chapter. Each chapter gets a customized, specially designed “cover” page that can’t really be designed in the WordPress WYSIWYG. There are certain aspects of each cover that can be templatized (like an h1, h2, and single paragraph — every chapter … Read more

Get current user data from external PHP page

I have a PHP page at the same level as the template/theme on WordPress. I need to be able to get the current logged in user details from this page. I have tried this: require_once( $_SERVER[‘DOCUMENT_ROOT’] . ‘/wp-load.php’ ); global $current_user; $current_user = wp_get_current_user(); var_dump( $current_user ); But it’s returning nothing. 0 as user_id and … Read more

ABSPATH not working! Any idea why?

This is what in my wp-config.php : if ( !defined(‘ABSPATH’) ) define(‘ABSPATH’, dirname(__FILE__) . “https://wordpress.stackexchange.com/”); I am calling from plugin/pluginName directory to : require_once( ABSPATH . ‘wp-includes/user.php’); But it is returning: Warning: require_once(ABSPATHwp-includes/user.php) [function.require-once]: failed to open stream: No such file or directory in /home/——/wp-content/plugins/—/—.php on line 43 Fatal error: require_once() [function.require]: Failed opening required … Read more

Show certain terms from custom taxonomy but exclude ‘parent’ terms?

I have a custom post type “mycustom_products” (hierarchical) that has custom taxonomies called ‘categories’ and ‘tags’ (as many other custom post types do). My custom category is called “myprod_category” (also hierarchical) and my tag taxonomy is called “product_tag” (not hierarchical). I want to show a list of Product Tags that correspond ONLY to certain Product … Read more

What is the most efficient method for loading widgets in functions.php

I have seen WordPress developers use two different methods for loading custom widgets from the functions.php file. The first: include(“functions/my-custom-widget.php”); The second: require_once(dirname(__FILE__) . “/functions/my-custom-widget.php”); Which one of these methods is more efficient. I’m particularly interested in performance if there is a difference at all. Does the require_once follow better ‘best practices’ ? I’m sure … Read more