Vasim Shaikh
  • Member for 5 years, 11 months
  • Last seen this week
Get current post id witout passing in shortcode
6 votes

add_shortcode( 'related-article', 'related_article_title' ); function related_article_title( $atts ) { global $post; echo $post->ID; // currently viewing post id ob_start(); $query =...

View answer
Wordpress Redirect: Default Password Reset URL
Accepted answer
4 votes

There is a filter to change the lost password url. Try this : add_filter( 'lostpassword_url', 'my_lostpassword_url', 10, 0 ); function my_lostpassword_url() { return site_url('/password-reset/');...

View answer
How do you log a user out with wp_logout?
4 votes

If you're using wp_logout in your own code, its probably best to exit or wp_redirect immediately afterwards. You can call wp_set_current_user(0) after wp_logout() to manually log the user out ...

View answer
How do i remove "Website" field from Wordpress comments
Accepted answer
3 votes

1. Using Plugins to disable Website field from comments There are many plugins available in the WordPress repository that remove the Website field from the blog comments. The most easy way is to ...

View answer
Fallback default image when there is no featured image
2 votes

Method 1: Set Default Fallback Image for Post Thumbnails Using Plugin This method is easier and recommended for all users. First thing you need to do is install and activate the Default Featured ...

View answer
Where is the email content for retrieve_password_message stored?
Accepted answer
2 votes

WordPress uses custom wp_mail function, so you won't find it, if you'll search for mail.You should find retrieve_password_message filter call there. This is the filter that returns the content of ...

View answer
WordPress 4.7.1 REST API still exposing users
1 votes

.htaccess code to block all author scans # BEGIN block author scans RewriteEngine On RewriteBase / RewriteCond %{QUERY_STRING} (author=\d+) [NC] RewriteRule .* - [F] # END block author scans You can ...

View answer
Show the same Article Available in Other Categories
1 votes

First you have to create secondary loop and use it. // $categories = wp_get_post_categories($post->ID); $categories = get_the_category($post->ID); foreach ( $categories as $...

View answer
Call to undefined function error in plugin
Accepted answer
1 votes

You can try following while you get such error: Searched for the php file with the function definition in it. Verified that the file exists. Verified that the require (or include) statement for the ...

View answer
Make default template two columns?
1 votes

1. Add .php in wp-content/themes/ Write <?php /** * Template Name: <subpage-name>, left sidebar * Description: A one-colum template with left sidebar for <subpage-name> ONLY */ ...

View answer
Apache HTTP Server stops working for only a certain local website
1 votes

First open your wp-config.php which is located in the root WordPress directory. Then add the following line inside the main php tag: define('WP_MEMORY_LIMIT', '64M'); We just increased the memory ...

View answer
Custom loop of a single category, cannot order by date. What am I missing?
1 votes

You can use the following code: global $post; $myposts = get_posts( 'numberposts=1&category=1' ); foreach( $myposts as $post ) : the_title(); the_content(); endforeach;

View answer
WooCommerce change category url and product base
1 votes

This is solution of your 404 links problem, Got to Settings -> Permalinks -> In 'Product permalink base' select the 'Shop base with category' option. For more you can visit, https://wordpress.org/...

View answer
Child page in custom post throws 404 page not found
1 votes

It turns out the Wordpress permalink structure works perfectly well for custom types, e.g. example.com/recipes/lunch/sandwich/. This works exactly as expected if you set 'hierarchical' => true. What ...

View answer
There has been an error cropping your image
0 votes

In some cases, the ImageMagick extension might not be installed or might be unreliable (old versions of ImageMagick can be buggy). If its okay then check the rest of points. It's the GD Library not ...

View answer
wp_list_categories() - current-cat class also inside posts?
0 votes

Based on the accepted answer, You just need to pass an extra parameter in. I just write down complete code so it's easy for understanding. <?php $taxonomy = 'category'; $term_id = 0; if(...

View answer
Multisite website configure Domain issue
0 votes

As per the instructions for setting up WordPress MU Domain Mapping, sunrise.php needs to be placed directly in your /wp-content directory. It's not a plugin in the traditional sense, so can't be ...

View answer
Display ACF field only if value is greater than 0
0 votes

$integerValue = str_replace(",", "", $unformatted); // Remove commas from string $integerValue = intval($integerValue); // Convert from string to integer $integerValue = number_format($...

View answer
Custom Taxonomy not working front side Woocommerce
0 votes

Add an already registered taxonomy to an object type. function add_hunts_type(){ /*Taxonomy details*/ register_taxonomy_for_object_type( 'carhunt', 'product' ); } add_action( 'init', '...

View answer
Undo User Role Name Change
Accepted answer
0 votes

Rename Existing Role Name : function wps_change_role_name() { global $wp_roles; if ( ! isset( $wp_roles ) ) $wp_roles = new WP_Roles(); if($wp_roles->roles['contributor']['name'] = 'Owner') { $...

View answer
Widget to embed youtube video
0 votes

In simple PHP,I am use this code : Url :have code that same as you genrate that appended at the end of url.I am work with core php. $url = 'http://www.youtube.com/watch?v=fHBFvlQ3JGY'; ...

View answer
Where to implement custom walker class?
0 votes

The walker class is an abstract class designed to help traverse and display elements which have a hierarchical (or tree like) structure. It doesn't actually 'do' (in the sense of generating HTML) ...

View answer
How to show only manual / custom excerpts?
0 votes

Found out a quick and easy way to fix it. Follow these instructions: Create a new post Do not introduce anything at the "Excerpt" field (in fact, disable Advanced Editing) Write your post Introduce ...

View answer
Using wp_enqueue_script on scripts that contain PHP
0 votes

I'm used this code recently to get variable in header image path.Add this function to your functions.php: function img() { return get_template_directory_uri().'/assets/img/'; } and use this in ...

View answer
Using wp_enqueue_script on scripts that contain PHP
0 votes

<?php // Register the script wp_register_script( 'some_handle', 'path/to/myscript.js' ); // Localize the script with new data $translation_array = array( 'some_string' => __( 'Some string ...

View answer
Fatal Error Paid Memberships Pro require includes/localization.php
Accepted answer
0 votes

Yes,Brotzka If you replace plugin with newest one the changes that are done in code file are vanish.Just move PMPro to some other place plugin folder refresh your site.

View answer
Override function
0 votes

Here is the code for overriding price of product in cart add_action( 'woocommerce_before_calculate_totals', 'add_custom_price' ); function add_custom_price( $cart_object ) { $custom_price = 10; /...

View answer
Need to delete a wordpress website from Cpanel
-1 votes

Move Site No need to Delete Step-1 : Login to Cpanel and move all folder to root folder (Normally public_html) Step-2 : Now,Show hidden file and rename htaccess file. Step-3 : Goto Database (i.e. ...

View answer
Custom Role with Own Page Edit Capability
-1 votes

Yes,i am not getting you very well this may helpful. http://easywebdesigntutorials.com/creating-a-custom-user-role/

View answer
Sort Popular Posts by Views for the Last Week
-2 votes

If you are looking for plugin then this is simple way to install Plugin: WordPress Popular Posts Add Shortcode to sidebar: [wpp range=weekly stats_comments=0 thumbnail_width=30 thumbnail_height=30 ...

View answer