get_post_thumbnail_id returns a negative number

Try this code: <?php $thumb_id = get_post_thumbnail_id(); $thumb_url = wp_get_attachment_image_src($thumb_id,’full’, true); if ( !empty($thumb_url[0])) { echo “There is a thumbnail and it’s id is: “.$thumb_id; } else { echo ‘There is no picture.’; } ?> For the second code, use: <?php $thumb_id = get_post_thumbnail_id(); $thumb_url = wp_get_attachment_image_src($thumb_id,’full’, true); if ( !empty($thumb_url[0]) ) : ?> <img … Read more

Multilanguage website on two different domains

Method 1. You can use .pot file to store translation and use wordpress default translator functions for all of your strings such as __e() Method 2: It is better to use any translator plugin since it will do all the necessory work for you. Few of them are here https://wpml.org/ https://wordpress.org/plugins/polylang/

A javascript function that simply runs a php function on the plugin

In your JS code, you need an action so it knows what function to execute. var data = { ‘action’: ‘my_action’, ‘nothing’: ‘nothing’ ‘whatever’: ajax_object.we_walue } You should see how the action corresponds to the hook you used in add_action. But I would also add a second action: add_action(‘wp_ajax_my_action’, ‘back_php’); add_action(‘wp_ajax_no_priv_my_action’, ‘back_php’); This will ensure … Read more

Find the method which AJAX GET calls

If the url is something like this admin-ajax.php?example_ajax_request=1&data=1234 The add_action function in the code would be wp_ajax_nopriv_example_ajax_request So, try to grep the whole of your theme directory or plugin directory for the text. Example: grep -r ‘wp_ajax_nopriv_example_ajax_request’ * The second parameter of the add_action is the function name you’re looking for. See https://codex.wordpress.org/AJAX_in_Plugins#Ajax_on_the_Viewer-Facing_Side for example … Read more