Function that replaces the image in the absence of the post meta

found the solution: $poster_path = get_post_meta($post->ID, “poster_path”, $single = true); if( $poster_path == “” ){ echo ‘<img width=”53″ height=”80″ src=”https://via.placeholder.com/370×556?text=No+Poster&000.jpg” />’; } else { echo ‘<img width=”53″ height=”80″ src=”https://image.tmdb.org/t/p/w370_and_h556_bestv2′.$poster_path.'” />’; }

Add text to variable

You’ve commented out the line that does this: //$excerpt = $excerpt + $summarizer_add_html_trust_bulletpoints ; The only mistake is that you’ve used + instead of ., which is the correct concatenation operator in PHP. $excerpt = $excerpt . $summarizer_add_html_trust_bulletpoints;

What is the alternative code to if (isset ($_POST) && !empty ($_POST) to avoid warnings?

filter_input is the proper way to go. If it doesn’t return anything valid, it will return null: $myvar = filter_input( INPUT_POST, ‘something’, FILTER_SANITIZE_STRING ); if ( empty( $myvar ) ) { // Do whatever you would have done for ! isset( $_POST[‘something’] ) } // Use $myvar filter_input won’t throw any notices if the requested … Read more

How to deal with too many $_POST variable conditions from ajax request at backend? [closed]

I Would start with creating a array that hold all “conditions” logic, loop it, check to see if some condition is met and return the value. $conditions = [ ‘variable_1’ => ‘DoSomeStuffWithVariable_1’, ‘variable_1’ => ‘DoSomeStuffWithVariable_1’, ‘variable_1’ => ‘DoSomeStuffWithVariable_1’, ‘variable_xy’ => ‘DoSomeStuffWithVariable_xy’ ]; foreach ($conditions as $condition_key => $condition_value) { if (isset($_POST[$condition_key])) { $returnArray[‘return’] = $model->$condition_value(); … Read more

Get access to variable from previous pageview, excluding ajax-calls

I found out you could identify ajax requests by the following if-statement if (defined(‘DOING_AJAX’) && DOING_AJAX) So problem solved using add_action(‘init’, ‘set_global_pixelcapival’); function set_global_pixelcapival() { if (defined(‘DOING_AJAX’) && DOING_AJAX) { } else { global $pixelcapival; $pixelcapival = pixelcapival(); global $prev_pixelcapival; $prev_pixelcapival=””; if(isset($_COOKIE[‘pixelcapival’])) { $prev_pixelcapival = $_COOKIE[‘pixelcapival’]; } setcookie(‘pixelcapival’, $pixelcapival, time() + 1200, “https://wordpress.stackexchange.com/”); } }

Get current page id, title, url, etc

<?php $link = “https://wordpress.stackexchange.com/questions/25552/mailto:?subject=”. get_bloginfo() .” ‘. the_title_attribute(array(‘echo’=>0)); $link .= ‘&amp;body=some text ‘. get_permalink(); ?> <a href=”https://wordpress.stackexchange.com/questions/25552/<?php echo $link ?>”>mail to a friend</a>

Getting values from options page to css

You are doing it correctly. I would suggest two enhancements: Do not put this code directly in header.php. Create a custom function to print the css and hook this into the wp_head action. Always sanitize/escape input before you print it to the screen. Look into ctype_xdigit() for creating a custom function to sanitize you color … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)