Highlight main menu when on specific posts or pages

As noted in comments above, the OP’s code generates malformed CSS. Per request, here is corrected code. It should help solve part of the issue (or prevent other issues) but I doubt it solves all of it. function blog_link_genesis() { if( is_single() || in_category(‘investors’) || is_page( array(4, 30))) { $current=”#header #nav #menu-item-133 a”; ?> <style … Read more

two sites, same code, different presentation

After walking through the code and examining everything else, I (finally) revisited the page definition in the Dashboard. There I noticed that the page was not associated with the page template I was working with. I assume that during the migration from the development web site to the production web site, the association went missing. … Read more

Restricting Post Content Visibility with Custom Code – where to put it?

you can place your function in functions.php and attach an action hook . which will decide when to call your function. If you only want to hide content of the posts you can use this hook add_action(‘the_content’, ‘yourcustomfunction’) or i would suggest this hook which will be called before your actually post query is run … Read more

Create new folder and upload files to custom folder via wp_handle_upload

This isn’t a working example but should help, Use wp_upload_dir() to define the default uploads folder and append a username to it using wp_get_current_user. $wp_upload_dir = wp_upload_dir(); $user_folder = wp_get_current_user(); // The actual folder $custom_upload_folder= $wp_upload_dir[‘basedir’] . $user_folder->display_name; //make the dir mkdir($custom_upload_folder); You would need to employ security and code that checks for errors/user capabilities … Read more

Add Custom Post Type on the Fly or create an array

use $wp_insert_post function to create posts and to create sub posts of this use this function again and set post_parent = “name of post you created” see list of all arguments and usage of this function wp_insert_post