Search
 
SCRIPT & CODE EXAMPLE
 

PHP

get_template_part parameters

//NEW CLEAN way (WP 5.5.0 >=) of passing variables to template parts 

$data = array('foo'=>'bar');

//add your variables as a third parameter
get_template_part( 'template-parts/file', 'name', $data );

//In the template part itself: (IMPORTANT NOTE: the name of the variable has to be args)
echo $args['foo'];
Comment

PREVIOUS NEXT
Code Example
Php :: yii2 redirect back 
Php ::  
Php ::  
Php :: php milliseconds 
Php :: pdo fetch 
Php :: php move file 
:: doument root phpp 
:: how to print query in laravel 
Php :: Check duplicate email using Jquery validation in laravel 
Php :: php get client ip 
Php :: unset _post 
Php :: php sleep half a second 
Php :: php read xml file into array 
::  
Php :: run php server mac 
::  
Php :: php date from mysql and date 
Php :: laravel plural and singular 
:: symfony exclude class from autowiring 
Php :: wp cli command activate plugin 
Php :: phoenix input type password 
Php :: laravel word count utf8 
Php :: xampp check php version 
Php :: php file get content json 
Php :: php get domain name from url 
Php :: php array move first element to last 
Php :: php get precent price 
Php :: laravel hasone users relations 
Php :: php get username from iis 
Php :: how to catch query exception in laravel 8 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =