Stumped on migration

You need to turn WP_DEBUG on in your wp-config.php: define( ‘WP_DEBUG’, true ); That’ll help a lot with working out where that 500 error is coming from. Based on the PHP versions you’ve mentioned, I’m 99.999% sure that the error is due to a feature that isn’t available in PHP 5.2.17. You’re probably looking at … Read more

How to link a Page with an anchor tag in WordPress

Actually the problem was with my page settings. If someone wants to link a php file to another php file by anchor tag (a href=”https://wordpress.stackexchange.com/questions/239574/….”) and wants to send some data through URL, he/she must has to make the targeted php file a page template. Like this <?php /*** Template Name: Gallery ***/ Then he/she … Read more

Attaching a pdf to Contact Form 7 e-mail via functions.php [closed]

I’ve found what’s been missing in the code. You have to add this also: add_filter( ‘wpcf7_mail_components’, ‘mycustom_wpcf7_mail_components’ ); function mycustom_wpcf7_mail_components( $components ) { $components[‘attachments’][] = get_template_directory().’/pdf/test.pdf’; return $components; } Now everything is working fine and the file is attached to email without the need to add fields in the contact form.

Pass PHP variable to JavaScript without inline JS

Untested but gosh darn it might just work… javascript file: jQuery( document ).ready(function() { jQuery.ajax({ url: // !! hardcode the URL of WP admin-ajax.php here, since you don’t want to use wp_localize_script() to pass it in… type: ‘POST’, data:{ action: ‘some_action’, // this is the function (via wp_ajax_ hook) that will be triggered }, success: … Read more

jQuery .each to get post meta and subtract from a sum

You don’t need to use jQuery for something like this, it would be better done if you just use php! So if you store those 3 values in variables you can then do basic math with that data about output the results. while ($query->have_posts()) : $query->the_post(); $tourNum1 = get_post_meta($post->ID, ‘tour_details_number’, true); $tourNum2 = get_post_meta($post->ID, ‘tour_details_number2’, … Read more

Do my defines need to be unique?

Yes they do, the more interesting question is why do you use define instead of const? Take a look here: define() vs const. The only situation in which you should use a define over const is if you want the user to be able to override your defines in wp-config.php. Obviously things like minimum php … Read more

Display post image with fancybox

When you echo something, you need to be echoing the variable. You are using the_post_thumbnail_url, which in itself is already an echo statement. You should be using get_the_post_thumbnail_url instead. echo “<a class=”fancybox” rel=”group” href=”” . get_the_post_thumbnail_url( get_the_ID(), “full’ ) . “‘>”; EDIT: Also, missing the $post_id, fixed to include it in the function