Get all user meta by meta key instead of ID

Two options. The first will keep you away from custom SQL, and should be a lot more efficient than what you currently have. It runs two queries, one to get the user ID with the highest hourly rate, and then again to get the lowest. You need one more query to update the user meta … Read more

WordPress vs. Custom PHP [closed]

1) That depends on who is building the custom PHP site and how much effort they put into it. If you build a shoddy custom PHP site, then it can easily be hacked. On the other hand, if you don’t take certain precautions then your WP site can be hacked too. I just finished up … Read more

Creating bulk posts with Youtube videos

You already have your updateYoutube() function. Edit it to insert a new post. Very generally: function updateYoutube( $videocode ){ global $conn; $run = $conn->query(“SELECT `ID` FROM `youtubetable` WHERE `ID` = ‘$videocode'”); if ($run->num_rows > 0) return false; else { if ($conn->query(“INSERT INTO youtubetable (`ID`) VALUES (‘$videocode’)”) === TRUE) { // ################################# // NOTE: The following … Read more

max_input_vars: how many am I using?

max_input_vars is the limit on the total number of GET, POST, and COOKIE vars. To determine how many there are you can just count them. Here’s a quick example in a WordPress context: function wpd_admin_error_notice() { echo ‘This request contained ‘ . count( $_POST ) . ‘ POST vars, ‘ . count( $_GET ) . … Read more

Get the the title of WordPress after comma

You can use in this way <?php $sTitle = “Your, Title”;// From get_the_title(); or other sources if(strpos($sTitle , “,”)){ $sTitle = substr($sTitle , strpos($sTitle , “,”) + 1); } echo $sTitle; // You can also trim($sTitle); to remove whitespaces left from substr() ?>

Help with some php math in WordPress

You just need to echo it. <?php echo $price – $trade; echo $trade / $sale; ?> or you can go more advanced by going <?php if ( ! is_admin() ) { // is admin then echo $price – $trade; echo $trade / $sale; } else { // is not admin then } ?>

Add itemprop Schema.org Markup to li Elements in wp_nav_menu

To add attributes to the menu’s li elements, you’d have to write your own custom walker that extends the default Walker_Nav_Menu class (which is itself an extension of the Walker class). For more info: https://codex.wordpress.org/Class_Reference/Walker But as itemprop=”url” should normally be added to anchor elements, you could use the nav_menu_link_attributes filter. For example, as per … Read more