const addSpan = (note: any) => {
return [...note].map((letter) => <span>{letter}</span>);
};
<div>{addSpan(seconds) || '00'}</div>
// Shortcode for projects [projects-list posts="3"]
function projects_listing_parameters_shortcode( $atts ) {
ob_start();
$args = shortcode_atts( array (
'type' => 'projects',
'posts' => 6,
'cat' => ''
), $atts );
$options = array(
'post_type' => $args['type'],
'posts_per_page' => $args['posts'],
'tax_query' => array(
array (
'taxonomy' => 'project',
'field' => 'slug',
'terms' => $args['cat'],
)
),
);
$query = new WP_Query( $options );
if ( $query->have_posts() ) $item = 0; {
while ( $query->have_posts() ) : $query->the_post(); $item++;
echo '<div class="item item-' . $item . '">';
get_template_part( 'template-parts/project-cards', get_post_format() );
echo '</div>';
endwhile;
wp_reset_postdata();
$myvariable = ob_get_clean();
return $myvariable;
}
}
add_shortcode( 'projects-list', 'projects_listing_parameters_shortcode' );
Page Template — If the page has a custom template assigned, WordPress looks for that file and, if found, uses it.
page-{slug}.php — If no custom template has been assigned, WordPress looks for and uses a specialized template that contains the page’s slug.
page-{id}.php — If a specialized template that includes the page’s slug is not found, WordPress looks for and uses a specialized template named with the page’s ID.
page.php — If a specialized template that includes the page’s ID is not found, WordPress looks for and uses the theme’s default page template.
singular.php — If page.php is not found, WordPress looks for and uses the theme’s template used for a single post, irregardless of post type.
index.php — If no specific page templates are assigned or found, WordPress defaults back to using the theme’s index file to render pages.
import { Link, useLocation } from 'react-router-dom';
const { search } = useLocation();
const params = {
lang: lang,
source: source,
offer: offer,
};
if (search !== '') {
to['search'] = queryString.stringify(params);
} else {
to['search'] = `lang=${lang}`;
}
<Link to={to}>Button</Link>
Technical note
Since the plugin hooks into the theme on client-side to intercept the comment form submit process, and to add new comments without reloading the page, the plugin needs to access the DOM nodes using jQuery selectors. The plugin comes with default values for these selectors that were successfully tested with WordPress’ default themes «Twenty Ten», «Twenty Eleven», «Twenty Twelve», «Twenty Thirteen», «Twenty Fourteen», «Twenty Fifteen», «Twenty Sixteen». If required, the selectors can be customized to match your theme in the plugin’s settings.
Google Translate:
Техническое примечание
Поскольку плагин подключается к теме на стороне клиента, чтобы перехватить процесс отправки формы комментария и добавить новые комментарии без перезагрузки страницы, плагину необходимо получить доступ к узлам DOM с помощью селекторов jQuery. Плагин имеет значения по умолчанию для этих селекторов, которые были успешно протестированы с темами WordPress по умолчанию «Двадцать десять», «Двадцать одиннадцать», «Двадцать двенадцать», «Двадцать тринадцать», «Двадцать четырнадцать», «Двадцать пятнадцать», «Двадцать». Шестнадцать". При необходимости селекторы можно настроить в соответствии с вашей темой в настройках плагина.
function comfort_item_shortcode() {
if ( have_rows( 'comfort' ) ) :
while ( have_rows( 'comfort' ) ) : the_row(); ?>
<div class="item">
<?php if ( get_sub_field( 'icon' ) ) : ?>
<img class="icon" src="<?php the_sub_field( 'icon' ); ?>" />
<?php endif ?>
<span class="text"><p><?php the_sub_field( 'text' ); ?></p></span>
</div>
<?php endwhile;
endif;
}
add_shortcode( 'comfort_item', 'comfort_item_shortcode' );
//Returns All Term Items for "my_taxonomy"
$term_list = wp_get_post_terms($post->ID, 'my_taxonomy', array("fields" => "all"));
print_r($term_list);
//Returns Array of Term Names for "my_taxonomy"
$term_list = wp_get_post_terms($post->ID, 'my_taxonomy', array("fields" => "names"));
print_r($term_list);
//Returns Array of Term ID's for "my_taxonomy"
$term_list = wp_get_post_terms($post->ID, 'my_taxonomy', array("fields" => "ids"));
print_r($term_list);
//Echo a single value - $term_list is an array of objects. You must select one of the
// array entries before you can reference its properties (fields).
$term_list = wp_get_post_terms($post->ID, 'my_taxonomy', array("fields" => "all"));
echo $term_list[0]->description ;
//Do something if a specific array value exists within a post
$term_list = wp_get_post_terms($post->ID, 'product_features', array("fields" => "all"));
foreach($term_list as $term_single) {
echo $term_single->slug; //do something here
}
$(document).ready(function () {
$('#block').mousemove(function (e) {
var xPos = e.pageX - $(this).position().left;
var yPos = e.pageY - $(this).position().top;
$( ".log" ).text( "parentX: " + xPos + ", pageY: " + yPos );
});
});
$(window).bind( 'DOMMouseScroll mousewheel', function ( event ) {
if( event.originalEvent.detail > 0 || event.originalEvent.wheelDelta < 0 ) {
$('body').removeClass('top');
} else {
$('body').addClass('top');
}
});