More WordPress tags to PHP Variables
$pix = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); $title = get_the_title( $ID ); $eventlink = get_the_permalink(); $excerpt = get_the_excerpt(); $url = get_template_directory_uri();
PHP | Type: PHP
Namespace; if function exists
WP-PageNavi CPT LISTING ALTERNATIVELY FOR BLOG LIST
PHP, WP/CP | Type: PHP
Patch count(): countable in wp-includes/post-template.php on line 284
Normally a bad idea to patch a WP core file, but here’s the patch: // original code: if ( $page > count( $pages ) ) //add [...]
PHP, WP/CP | Type: PHP
PHP 7.2 Countable issue
Before PHP 7.2 when passing a non-array to count(), it returned 1. With 7.2, count() emits a warning when you give it a non-array.
PHP | Type: PHP
PHP Date/Time Guide
Useful php date/time formulas.
¡Important!, PHP | Type: PHP
Random order with ACF Repeater field
Repeatable fields can be stored in an array using PHP, and using the PHP shuffle() function, we can shuffle the array elements.
ACF, PHP | Type: PHP
RankMath Functions
Move RankMath metabox to bottom of the edit screen //change the metabox display location to bottom function rank_math_change_metabox_priority() { return 'low'; } add_filter( 'rank_math/metabox/priority', 'rank_math_change_metabox_priority' ); [...]
PHP, WP/CP | Type: PHP
Remove Items from WP/CP Admin Bar
// Remove items from the admin bar function remove_from_admin_bar($wp_admin_bar) { /* * Placing items in here will only remove them from admin bar * when viewing [...]
PHP, WP/CP | Type: PHP
Removing autop, and when you can’t remove it
The autop function can be very annoying when you’re trying to format content. But some plugins depend on autop to work, such as the checkout function [...]
eCommerce, PHP, WP/CP | Type: PHP
Rendering a Readable Date from Start Date
$mtgdate = DateTime::createFromFormat('Ymd', $startdate)->format('F j, Y'); echo '<p class="read-more"><a href="'.$formurl.'?mtgdate='.$mtgdate.'">'.$linktext.'</a></p>';
Date/Time, Forms, PHP | Type: PHP