how can i add any html tag before title. ex. <span>title<span> and how could print image first then title
any update for it. i am facing still issue. this is long ago request
thank you so much. it is working nicely
can you please share final code. i want to do similar thing also.
thank you so much. it is working but shortcode not showing. i want remove p and shortcode work. how to do
Can you help me for write query for me. bellow is my code. i want hide or make it draft.
<?php query_posts($query_string); ?>
<?php while ( have_posts() ) : the_post(); ?>
<li>
<h2><?php the_title(); ?></h2>
<h5> <?php the_field('expire'); ?></h5>
<a href="<?php the_permalink() ?>">Details</a>
</li>
<?php endwhile;
?>
where should i paste this code ? inside function.php (theme) or else ?
should i need to open acf-post-category-ancestor-location-rule.php file and replace your code ?
i want to this feature too.
i want to make rules main category and it will effect all sub category also.
ex.
Gallery
Sub gallery 1
Sub gallery 2
Sub gallery 3
so if put rules for gallery then it will effect on all sub gallery also.
wow… cool !!!!! @James … it work super 🙂 thank you so much.
two issue solve it here 🙂
Thanks again for great and quick support
Thanks for reply.
actually before code was loop. meaning all child category image will show. that was fine work.
but now i need also only show category image. not loop all child category.
example my category like bellow
so now when i will view/access 4 color category (cat-printing.php this page for all printing child category template ) then in that page will show 4 color category image only
i tried you code not work really . it show error foreach($categories as $category){
now i am facing one small issue. bellow is my code. it is working fine. i get proper value but issue i want only active category value. bellow code show all category image loop
<?php
$args = array('child_of' => 67);
$categories = get_categories( $args );
foreach($categories as $category)
{
$image = get_field('cat_thumbnail_image', $category->taxonomy . '_' . $category->term_id );
echo '<div class="test">'.$image.'</div>';
}
?>
COOL… this is work. 🙂 thanks you so much for quick and great support ..
it show long dump code i just paste part
<?php
$args = array('child_of' => 43);
$categories = get_categories( $args );
foreach($categories as $category)
{
$image = get_field('cat_thumbnail_image', '47');
echo '<pre>';
echo "Image field value:";
var_dump($image);
echo "Category value:";
var_dump($category);
echo '</pre>';
}
?>
47 is my one of category id.
result bellow
Image field value:NULL Category value:object(WP_Term)#399 (17) { ["term_id"]=> int(47) ["name"]=> string(7) "Banners" ["slug"]=> string(14) "banner-designs" ["term_group"]=> int(0) ["term_taxonomy_id"]=> int(47) ["taxonomy"]=> string(8) "category" ["description"]=> string(124) "We design and print custom size banners for all industries including motorsports, transportation, special events & more." ["parent"]=>
This is filed section screenshot
This is category section screenshot
i can not put static category id. because under my category i have more sub category, in my query i wan to show all child category title, description and image
i tried
$image=get_image('cat_thumbnail_image'.$category->term_id);
>> error showing
and
$image=get_field('cat_thumbnail_image', 'category_'.$category->term_id);
>> image filed empty
and
$image=get_field('cat_thumbnail_image', $category);
>> image filed empty
wow.. superd…………. work nicely with minimum code. Thank you so much for great support
cool. this is work. would you check bellow code correct way or not, have any better way to do for this. i have more than one filed.
<h2><?php
$product_cat_object = get_queried_object();
the_field('side_box_title', 'product_cat_' . $product_cat_object->term_id);
?></h2>
<?php
$product_cat_object2 = get_queried_object();
the_field('side_box_content', 'product_cat_' . $product_cat_object2->term_id);
?>
thank you so much for quick reply. yes this work. but i need id dynamic. now all category page show same information because ID is i define hard coded. it need to dynamic base on category page. would you please support.
this is my url for one product category page ../wp-admin/edit-tags.php?action=edit&taxonomy=product_cat&tag_ID=7&post_type=product
from there i take ID 7 and put there. so code will be like now <?php the_field('side_box_title', '7'); ?>
but nothing is come. remember this is woocommerce product category page
few code from that page
<?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
<h1 class="page-title"> <?php woocommerce_page_title(); ?></h1>
<?php endif; ?>
<?php
/**
* woocommerce_archive_description hook
*
* @hooked woocommerce_taxonomy_archive_description - 10
* @hooked woocommerce_product_archive_description - 10
*/
do_action( 'woocommerce_archive_description' );
?>
</div>
<div class="cat-left-pan">
<div class="cat-widget">
<?php the_field('side_box_title', '7'); ?>
</div>
thank u so much. it is work
without 3rd party plugins not possible to set filed for nav menu ?
without change anything if i just copy and paste your code then only title coming. i checked html generate code also nothing there even
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.