Manually Create PHP Page For A Redirect

I guess you are talking about a specific page, for example domain.com/page? So you can create a generic page template (and select it for the page in WordPress admin panel) or create a template for the specific page. See instructions here. In this template you can add your php code for the redirect. If this … Read more

Display the video of a post_format Video

I made a function that return the iframe for the first video inside the post with id $post_id: function get_first_video_embed($post_id) { $content = apply_filters(‘the_content’, get_post_field(‘post_content’, $post_id)); $iframes = get_media_embedded_in_content( $content, ‘iframe’ ); return $video_post_iframe = $iframes[0]; }

WooCommerce “Checkout Now” button [closed]

Try this – Add your button inside a form and write down script to add product to the cart and redirect user directly to the checkout page. Suppose, following is the button that you can put on single product page using a WooCommerce hook. <button name=”checkout_now”> Checkout Now </button> PHP code: global $woocommerce; $post_id = … Read more

Only display title when there are results

You can do a conditional check before your loop to see if your query has any posts. And only display the title and the div if there is any posts to display. $your_query = new WP_Query( $args ); if( $your_query->have_posts() ) : // Add this line here to check if the query has posts. echo … Read more

$wpdb->get_results breaking page?

For me the problem would be to use a plugin that uses evil() eval() to evaluate string as PHP, in the first place 😉 This part is from the PHP manual: Caution The eval() language construct is very dangerous because it allows execution of arbitrary PHP code. Its use thus is discouraged. If you have … Read more

can’t get errors

First of all, you have ini_set(‘display_errors’, 0); in there, so you tell PHP that it should NOT display any errors. And there can be another reason… error_reporting can be set in such way, that no errors are reported. So this might help: define(‘WP_DEBUG’, true); if (WP_DEBUG) { define(‘WP_DEBUG_LOG’, true); define(‘WP_DEBUG_DISPLAY’, true); ini_set(‘display_errors’, 1); ini_set(‘display_startup_errors’,1); ini_set(‘error_reporting’, … Read more

help with custom shortcode that stopped working

WordPress 4.2.3 made some changes to the way shortcodes work in order to fix a security issue. See here: https://make.wordpress.org/core/2015/07/23/changes-to-the-shortcode-api/ This is most likely the cause of your problem. See the Shortcodes with Bad Quotes section, and the accompanying workaround suggestion.