Can’t access data from database using AJAX

Pass data as an argument in done(function(data) funtion. <script> jQuery.ajax({ type:”POST”, url: my_ajax_object.ajax_url, data: { ‘action’: ‘call_my_ajax_handler’ } }).done(function(data) { console.log(data); });

Notice: Use of undefined constant REQUEST_URI – assumed ‘REQUEST_URI’ in ….functions.php on line 73

*Without quotes PHP interprets the REQUEST_URI as a constant** but corrects your typo error if there is no such constant and interprets it as string. When error_reporting includes E_NOTICE, you would probably get an error such as: Notice: Use of undefined constant REQUEST_URI – assumed ‘REQUEST_URI’ in <file path> on line <line number> But if … Read more

Query posts by custom fields (object post)

If you use Post Object field type, then it is stored as ID in custom field. So this should do the trick: $posts = get_posts(array( ‘numberposts’ => -1, ‘post_type’ => ‘post’, ‘meta_key’ => ‘<FIELD_NAME>’, ‘meta_value’ => <POST_ID> )); PS. You should use ‘posts_per_page’ instead of ‘numberposts’ (which is deprecated).

A number appears inside a div called wpb_wrapper, when I use a custom shortcode

You can’t return an include like that. A successful include() itself returns 1, and since you’re returning the return value of include, your shortcode is displaying “1”. Handling Returns: include returns FALSE on failure and raises a warning. Successful includes, unless overridden by the included file, return 1. — http://php.net/manual/en/function.include.php If you want to output … Read more

custom post type single page template not working

Please see the Template Hierarchy. There is no template-portfolio.php template. It needs to be archive-portfolio.php. Also, you should not be using a custom query*. Use the main query in your post type archive templates. WordPress already queries the correct posts for you. So remove: $portfolio = new WP_Query(‘post_type’=> ‘portfolio’); And replace: while ($portfolio-> have_posts() ) … Read more

How to recognize which plugin generated this code?

I found the plugin by running a search for the string “text_dd” in the wp-content/plugins/ directory. Looks like this specific plugin (which provides text_dd, column_dd and section_dd shortcodes) is called “dnd-shortcodes” and contains the following snippet of information: Plugin Name: Drag and Drop Shortcodes Plugin URI: http://themeforest.net/user/AB-themes?ref=AB-themes Description: Visual drag and drop page builder containing … Read more

Adding placeholder text field to woocommerce checkout [closed]

Add the code in your themes functions.php. add_filter( ‘woocommerce_checkout_fields’ , ‘override_billing_checkout_fields’, 20, 1 ); function override_billing_checkout_fields( $fields ) { $fields[‘billing’][‘billing_first_name’][‘placeholder’] = ‘Enter First Name’; $fields[‘billing’][‘billing_last_name’][‘placeholder’] = ‘Enter Last Name’; return $fields; } Solved by adding the code in this way