Tell us what you are trying to do?
We've made a new post type to add new blogs
Is there any documentation that you are following?
I've used the videos on the toolset website
Is there a similar example that we can see?
We made a test post on the website
What is the link to your site?
hidden link
Hello,
How do you display the published date?
I have tried it in a fresh WP installation+ the latest version of Toolset plugins, it works fine. See below sandbox site:
Login URL:
hidden link
Test custom post:
hidden link
Both Toolset single field block and WordPress built-in paragraph block can display the publish date correctly, see it in frontend:
hidden link
More help:
https://toolset.com/block-item/single-field/
https://toolset.com/glossary/dynamic-fields/
This is our php for getting the posts
<?php
include '../../../../wp-config.php';
// Set Vars
$type = $_POST['type'];
$limit = $_POST['limit'];
$offset = $_POST['offset'];
$filter = $_POST['filter'];
$args = array('post_type' => $type, 'offset' => $offset, 'numberposts' => $limit);
if (!empty($filter['tax']) && $filter['tax'] != ''){
foreach($filter['tax'] as $term_key => $term_value){
if ($term_value != '*'){
$args['tax_query'][] = array(
'taxonomy' => $term_key,
'field' => 'slug',
'terms' => $term_value
);
}
}
}
$posts = get_posts($args);
foreach($posts as $post_key => $post){
$post_meta = get_post_meta($post->ID);
echo '<a href="'. get_the_permalink($post->ID) .'" class="single-post">';
echo '<div class="image-wrapper">';
echo '<img src="'. get_the_post_thumbnail_url($post->ID) .'"/>';
echo '</div>';
echo '<span class="date">'. strftime('%e %B %Y', $post_meta['wpcf-news-date'][0]) .'</span>';
echo '<h3 class="post-title">'. $post->post_title .'</h3>';
echo '<p class="excerpt">'. $post_meta['wpcf-news-archive-text'][0] .'</p>';
echo '<span class="read-more">Lees meer <i class="fas fa-arrow-right"></i></span>';
echo '</a>';
This is the archive php code
<?php
get_header();
echo '<div class="archive-wrapper post-content">';
echo '<div class="intro-wrapper">';
echo '<div class="filter-wrapper">';
$terms = get_terms('jubileum-category', array('hide_empty' => false,));
echo '<div class="filter current" data-filter-value="*" data-filter-key="jubileum-category" data-filter-type="tax"> Alles </div>';
foreach ($terms as $term){
echo '<div class="filter" data-filter-value="' . $term->slug . '" data-filter-key="jubileum-category" data-filter-type="tax">' . $term->name . '</div>';
}
echo '</div>';
echo '</div>';
echo '<div class="post-wrapper archive-container">';
echo '<div class="jubileum-wrapper grid" id="jubileum-wrapper"></div>';
echo '<div id="post-loader"><img src="' . get_stylesheet_directory_uri() . '/img/loader.svg"/></div>';
echo '<div id="load-wrapper"> <span class="load-more c-button">Laad meer</span></div>';
echo '</div>';
echo '</div>';
get_footer();
?>
<script src="<?php echo get_stylesheet_directory_uri(); ?>/ajax/get-posts.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($){
// Set Vars
var outputID = 'jubileum-wrapper';
type[outputID] = 'jubileum';
limit[outputID] = 6;
offset[outputID] = 0;
filter[outputID] = {'tax' : {}, 'term' : {}};
// Execute Functions
getPosts(outputID, true);
// Filter
$('.filter-wrapper').on('click', '.filter', function(){
$('#' + outputID).html('');
filter[outputID][$(this).data('filter-type')][$(this).data('filter-key')] = $(this).data('filter-value');
getPosts(outputID, true);
$('.filter-wrapper .filter').removeClass('current');
$(this).addClass('current');
});
// Load more
$('#load-wrapper').on('click', '.load-more', function(){
getPosts(outputID, false);
});
});
</script>
<?php
get_footer();
The screenshot you mentioned above:
https://toolset.com/wp-content/uploads/2023/02/2556419-2023_02_17_09_25_33_Edit_Jubileum_post_Interview_met_onze_oprichtster_Tedas_WordPress.png
It is not WordPress built-in post publish date, if it is a custom date field created with Toolset Types plugin, you can use types_render_field() PHP function to output field value, see our document:
https://toolset.com/documentation/customizing-sites-using-php/functions/#date
For example:
types_render_field("DATE-FIELD-SLUG", array("format" => "Y-m-d"));
My issue is resolved now. Thank you!
I found out because you mentioned the date, that I was calling the wrong post type date.
Thank you for your time.