Articles of functions

wp-comments-post.php file returns a blank page

When i post a reply to my blog, it’s return a blank page to me. It seems that happens because of this code in wp-comments-post.php if ( ‘POST’ != $_SERVER[‘REQUEST_METHOD’] ) { header(‘Allow: POST’); header(‘HTTP/1.1 405 Method Not Allowed’); header(‘Content-Type: text/plain’); exit; } I hosted the same blog with the same content in other hosting […]

php function to display commenter username or login

I want to display the commenters username or login name in a comment template. I know there is a function comment_author_link(), but this displays the “display name publicly as” name and not necessarily the username. Usernames have to be unique so I would prefer to display the username. I have tried some other functions and […]

theme_root returning a truncated URI

I’m unable to access the theme editor via the control panel, receiving ‘Sorry can’t edit files with .. in the name….’ and after trying to trace back the cause, I’ve found that the theme_root is being returned as /home/ rest is correct). I’m at a loss to determine where the theme_root is being read/set from […]

How to remove custom post type and add category and post name

I have a custom post type called listing and taxonomy for this listing is called listing_cat. At the moment my wordpress permalinks appear in this format localhost/wordpress/listing/listing_cat/post_name I want to remove listing from permalink so it would appear in this format. localhost/wordpress/listing_cat/post_name Problem is when I remove listing from permalink with the help of “post_type_link” […]

Multiple Loops Meta Data

I am now trying to figure out how to create the functions/ loops to pull my data from custom post types. I have two post types(keys): And I need to pull the data from both to run my functions. pods_product_grps: (p_high, p_med, p_low, m_type, group_id) product_variant: (cogs, area, img_min, img_max, product_sku, grp_id) Post are connected […]

How to access global variable $menu inside a class function

am puzzling why can’t i access the global variable $menu inside a php class function class adminMenus { public function getWPdefaultmenus(){ global $menu; return $menu; } } using this code in a plugin file and this function still return NULL. Edited what i am doing after @Will the Web Mechanic’s answer class adminMenus { private […]

Move Custom Fields on General Settings Page to New Location

I’ve created some custom fields on the General Settings page after studying up on this post: Add multiple custom fields to the general settings page. I’d really like to move them to their own location – preferably a new menu item, or at least under the Settings menu item. I seen tutorials on how to […]

Detecting classes, adding widgets, and adding divs in with a Nav Walker

I’ve been trying to figure this out for days, to no avail. A template I’m building requires a mega menu. The markup for the menu looks like this: <nav> <ul> <li><a href=”#”>General Information</a></li> <li> <a href=”#”>Programs</a> <section> <ul> <li><a href=”#”>Birthday Parties</a></li> <li> <a href=”#”>Athletics</a> <ul> <li><a href=”#”>Youth</a></li> <li> <a href=”#”>Adult</a> <ul> <li><a href=”#”>Adult Softball</a></li> <li><a […]

How to Reference/Echo Variable from Another PHP Function

I have successfully set up a PHP function for my blog posts to create a shortcode to automatically display/style an iFrame tag for a YouTube video, as well as pull in the duration and view count immediately underneath. I am now looking to display JUST the view count and duration values for the video on […]

Remove echo from shortcode

I’ve just started playing with shortcodes and due to my lack of php knowledge I am unable to figure out how to make this shortcode work without using php echo. Can anyone help me revise my code? // SPONSORS Shorcode function sponsors_shortcode($atts) { extract(shortcode_atts(array( “name” => “sponsors”, ), $atts)); $args = array( “post_type” => “sponsors”, […]