Using PHP for background-image property [closed]
Well it seems you are using ACF. The you need not echo the_field() only echo get_field(”)
Well it seems you are using ACF. The you need not echo the_field() only echo get_field(”)
You should use WordPress’s built in function wp_enqueue_style for loading styles. /** * Proper way to enqueue scripts and styles */ function wpdocs_theme_name_scripts() { wp_enqueue_style( ‘style-name’, get_stylesheet_uri() ); wp_enqueue_script( ‘script-name’, get_template_directory_uri() . ‘/js/example.js’, array(), ‘1.0.0’, true ); } add_action( ‘wp_enqueue_scripts’, ‘wpdocs_theme_name_scripts’ ); https://developer.wordpress.org/reference/functions/wp_enqueue_style/
if(get_sub_field(‘catalog_product_title’)); ; is for ending a statement in php If you remove that ; your if statement should work.
You’re really close – get_header_image() returns the URL of the image, whereas header_image() echo’s out the URL. Because you’re setting your style tag in a variable and then echo’ing that, you need to use the function that returns the header image URL – so, like this: $banner=”style=”background-image:url(“. get_header_image() .’);”‘; Using header_image() will, as you found, … Read more
It seems that you miss some PHP basics? http://php.net/manual/en/language.operators.string.php Anyhow, This $post_categoria = new WP_Query(‘category_name=name-category’); Should become this: $post_categoria = new WP_Query(‘category_name=” . $nisola);
Quite often, after WP or plugin updates, just re-saving the Settings->Permalinks works for me (without changing anything).
As PHP documentation says Often you’d want to have more than one statement to be executed conditionally. Of course, there’s no need to wrap each statement with an if clause. Instead, you can group several statements into a statement group. So You have to use curly braces {} to add more statement within if else … Read more
read https://developer.wordpress.org/reference/functions/single_cat_title/ set the $display parameter to false; i.e. use: if(in_array( single_cat_title( ”, false ), $visible_titles)) {
You have to change this in functions.php if (!function_exists(‘my_commonPriceHtml’)) { function my_commonPriceHtml($price_amt, $regular_price, $sale_price) { $html_price=”<p class=”price”>”; //if product is in sale if (($price_amt == $sale_price) && ($sale_price != 0)) { $html_price .= ‘<ins>’ . wc_price($sale_price) . ‘</ins>’; $html_price .= ‘ <del>’ . wc_price($regular_price) . ‘</del>’; } //in sale but free else if (($price_amt == $sale_price) … Read more
Use COOKIEPATH and COOKIE_DOMAIN constants. setcookie( ‘welcomeback’, ucfirst( $_POST[‘firstname’] ), strtotime( ’27 Feb 2017′ ), COOKIEPATH, COOKIE_DOMAIN );