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 } ?>

printf – problem to understand code

__( ‘Remove Track’ ) is a translatable string. __(), _e(), _x(), … all of them are gettext functions used by WordPress for language localization. It is missing the second parameter (optional), which is the textdomain, usually it should be: __( ‘Remove Track’, ‘your-plugin-text-domain’ ) In that way, the string can be translated by your plugin … Read more

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