Custom $_SESSION expires too early

One tip from here: Set cookie parameters defined in the php.ini file. The effect of this function only lasts for the duration of the script. Thus, you need to call session_set_cookie_params() for every request and before session_start() is called. You are calling it after.

Remove &nbsp from the_excerpt

I’m not sure why there’s a non-breaking space being added to the front of your excerpt. It would be best to find out what is putting that there. But in the meantime, you can add this to your theme functions.php ( or a simple plugin ) and it should take care of it. //* Remove … Read more

Can’t change website Title on wordpress

Please check your header.php file, and see if the <title> attribute isn’t fixed to the the Theme’s name. Also, if the All in One SEO Pack did modify it on the browser, other services (like facebook) cache the metadata from urls shared, and you would need to manually flush them. (Facebook for instance has this … Read more

Problems clearing cache

After more than a half of a day of battle, I found out that style.css has to be in direct subdirectory of a child theme. I had placed it under the /css/ folder together with other styles. That’s why WordPress couldn’t find PHP files… Weird thing is that this folder structure has worked when I … Read more

Composer setup-config.php not found

Your WordPress is installed under the localhost/wordpress/ instead of localhost/. If you are running your WordPress for the first time, point your url to localhost/wordpress/wp-admin/install.php so that the correct path can be setup by the WordPress.

Have Woocommerce show product price if id, when not logged in

If you know the id, you can simply check current product id in your woocommerce_get_price_html action: add_action(‘after_setup_theme’,’activate_filter’) ; function activate_filter() { add_filter(‘woocommerce_get_price_html’, ‘show_price_logged’); } function show_price_logged($price) { global $product; // get current product if(is_user_logged_in() || $product->id === 8) { // check product id return $price; } else { remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’ ); remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_price’, … Read more

How to use wp_nav_menu to create custom dropdown menu?

Use wp_nav_menu() with proper parameters to add the dropdown-menu forAnimate class, to remove the wrapper and to add the role attribute: <ul class=”nav navbar-nav”> <li class=”active”><a href=”https://wordpress.stackexchange.com/questions/255497/index.html”>Home</a></li> <li><a href=”category.html”>Category Page</a></li> <li><a href=”article.html”>Article Page</a></li> <li class=”dropdown”> <a href=”#” class=”dropdown-toggle” data-toggle=”dropdown”> Category Type A <span class=”caret”></span></a> <?php wp_nav_menu(array( ‘menu’ => ‘my_menu_name’, // specify the menu name ‘menu_class’ … Read more

How can I include the user id inside of a shortcode php output?

So I’m assuming the “current commenter” is actually the current user logged into WP. So to get the current user ID, you can simply use get_current_user_id: echo do_shortcode(“[theplugin_user_data user_id='” . get_current_user_id() . “‘]”); UPDATE Ok, so we want, then, the comment’s author ID: //$comment = get_comment(); // in your case, it seems you already have … Read more