Get post format and use it as a CSS class in different spans

Every post has a maximum of one format and one status. To echo the format you need: if (get_post_format($post->ID)) echo ‘<span class=”format-‘ . get_post_format($post->ID); . ‘”></span>’; To echo the status you need this: if (get_post_status($post->ID)) echo ‘<span class=”status-‘ . get_post_status($post->ID); . ‘”></span>’; Hopefully this is what you need.

Can I add generic numbering HTML classes to items as a loop runs?

You could use post_class within the loop. <?php post_class( ‘myclass-here’); ?> This will add the necessary HTML class=”” and WP defaults classes plus your new myclass-here class You could then use counters within the loop to add a unique suffix to your post class // Outside the loop initialize your counter $counter = 1; . … Read more

echo custom fields with AJAX

I’m not sure Why you used loop to display your post meta. and you code are all ok but you have to change little-bit. Q. Why you used inline script ? On my opinion you should used external script file to do this. anyway that’s not the main issue here. In order to work with … Read more

How to execute html code inside php?

I wouldn’t recommend writing PHP code in the content this way, e.g. for security reasons. Most likely the shortcode is using eval() and you need a valid PHP code snippet in each such call. The PHP documentation has this warning: Caution The eval() language construct is very dangerous because it allows execution of arbitrary PHP … Read more

Adding a Calculator to a WordPress Page

You should look into creating a plugin for this and then inside of the plugin generating a shortcode for the output so you can place it almost anywhere you’d like inside wordpress. Having it has a plugin will give you the flexibility of quickly making changes and the future chance to apply it easily to … Read more

php within html within php

You can format it as, there’s also no need to put the echo <?php next_post_link(‘%link’,”<img src=”https://wordpress.stackexchange.com/questions/251458/. CFS()->get(“image_location’) . “/>”); ?> CFS()->get(‘image_location’) gets the field based on the current post id. If you want to use it for the next or previous, you have to pass the next or previous posts ID. You can do something … Read more

How to retrieve the data from the sever and displaying it in a page?

So in this case, the problem is that your line right before the echo call is incomplete: $number_rows= $wpdb->get_var( “SELECT COUNT(*) FROM $wpdb->daviddgl_wp1.SaveContactForm7_7” ); $x=1; while ($x<$number_rows) { $results = $wpdb->get_results(“SELECT ticket, name,email FROM $wpdb->daviddgl_wp1.SaveContactForm7_7 WHERE id = $x”); print_r($results); $x++; } (You’re missing the closing bracket and semi-column) Note also that your echo will … Read more