Displaying categories?
up vote
0
down vote
favorite
Such a problem in WordPress, I want to display on the page information about categories, as well as their image ... I added the image in the category using the ACF plugin, all data is displayed: name, description, but the picture is not, here is my code, what's wrong tell me?
<?php
$categories = get_categories(array('hide_empty' => 0, 'taxonomy' => 'authors-category'));
foreach ($categories as $cat) {
$id = $cat->cat_ID;
$term = get_queried_object();
$cat_img = get_field('category_image', $cat);
?>
<!--Author-->
<div class="author-block">
<div class="photo-author" style="background: url(<?php echo $cat_img['url']; ?>) #f3b458 no-repeat center center;background-size: cover;"></div>
<div class="name-author"><?php echo $cat->name ?></div>
<div class="count-post-author">
41 post </br>
<a href="#">See All Posts By The Author</a>
</div>
<div class="content-author">
<?php echo $cat->description ?>
</div>
</div>
<!--End Block-->
<?php } ?>
This is what happened, only in place of the figure should be pictures:
php wordpress
add a comment |
up vote
0
down vote
favorite
Such a problem in WordPress, I want to display on the page information about categories, as well as their image ... I added the image in the category using the ACF plugin, all data is displayed: name, description, but the picture is not, here is my code, what's wrong tell me?
<?php
$categories = get_categories(array('hide_empty' => 0, 'taxonomy' => 'authors-category'));
foreach ($categories as $cat) {
$id = $cat->cat_ID;
$term = get_queried_object();
$cat_img = get_field('category_image', $cat);
?>
<!--Author-->
<div class="author-block">
<div class="photo-author" style="background: url(<?php echo $cat_img['url']; ?>) #f3b458 no-repeat center center;background-size: cover;"></div>
<div class="name-author"><?php echo $cat->name ?></div>
<div class="count-post-author">
41 post </br>
<a href="#">See All Posts By The Author</a>
</div>
<div class="content-author">
<?php echo $cat->description ?>
</div>
</div>
<!--End Block-->
<?php } ?>
This is what happened, only in place of the figure should be pictures:
php wordpress
is it just displaying a no image icon? it may be your path. do a var_dump($cat_img); to see what that outputs
– comphonia
Nov 11 at 3:25
@comphonia , it gets the number "39", where it comes from, I don't know
– Nikita Yakovlev
Nov 11 at 12:07
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Such a problem in WordPress, I want to display on the page information about categories, as well as their image ... I added the image in the category using the ACF plugin, all data is displayed: name, description, but the picture is not, here is my code, what's wrong tell me?
<?php
$categories = get_categories(array('hide_empty' => 0, 'taxonomy' => 'authors-category'));
foreach ($categories as $cat) {
$id = $cat->cat_ID;
$term = get_queried_object();
$cat_img = get_field('category_image', $cat);
?>
<!--Author-->
<div class="author-block">
<div class="photo-author" style="background: url(<?php echo $cat_img['url']; ?>) #f3b458 no-repeat center center;background-size: cover;"></div>
<div class="name-author"><?php echo $cat->name ?></div>
<div class="count-post-author">
41 post </br>
<a href="#">See All Posts By The Author</a>
</div>
<div class="content-author">
<?php echo $cat->description ?>
</div>
</div>
<!--End Block-->
<?php } ?>
This is what happened, only in place of the figure should be pictures:
php wordpress
Such a problem in WordPress, I want to display on the page information about categories, as well as their image ... I added the image in the category using the ACF plugin, all data is displayed: name, description, but the picture is not, here is my code, what's wrong tell me?
<?php
$categories = get_categories(array('hide_empty' => 0, 'taxonomy' => 'authors-category'));
foreach ($categories as $cat) {
$id = $cat->cat_ID;
$term = get_queried_object();
$cat_img = get_field('category_image', $cat);
?>
<!--Author-->
<div class="author-block">
<div class="photo-author" style="background: url(<?php echo $cat_img['url']; ?>) #f3b458 no-repeat center center;background-size: cover;"></div>
<div class="name-author"><?php echo $cat->name ?></div>
<div class="count-post-author">
41 post </br>
<a href="#">See All Posts By The Author</a>
</div>
<div class="content-author">
<?php echo $cat->description ?>
</div>
</div>
<!--End Block-->
<?php } ?>
This is what happened, only in place of the figure should be pictures:
php wordpress
php wordpress
edited Nov 11 at 3:32
Nick
19.7k51434
19.7k51434
asked Nov 11 at 2:57
Nikita Yakovlev
1
1
is it just displaying a no image icon? it may be your path. do a var_dump($cat_img); to see what that outputs
– comphonia
Nov 11 at 3:25
@comphonia , it gets the number "39", where it comes from, I don't know
– Nikita Yakovlev
Nov 11 at 12:07
add a comment |
is it just displaying a no image icon? it may be your path. do a var_dump($cat_img); to see what that outputs
– comphonia
Nov 11 at 3:25
@comphonia , it gets the number "39", where it comes from, I don't know
– Nikita Yakovlev
Nov 11 at 12:07
is it just displaying a no image icon? it may be your path. do a var_dump($cat_img); to see what that outputs
– comphonia
Nov 11 at 3:25
is it just displaying a no image icon? it may be your path. do a var_dump($cat_img); to see what that outputs
– comphonia
Nov 11 at 3:25
@comphonia , it gets the number "39", where it comes from, I don't know
– Nikita Yakovlev
Nov 11 at 12:07
@comphonia , it gets the number "39", where it comes from, I don't know
– Nikita Yakovlev
Nov 11 at 12:07
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Solved the problem by switching the settings in the plugin
Array to URL
enter image description here
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Solved the problem by switching the settings in the plugin
Array to URL
enter image description here
add a comment |
up vote
0
down vote
Solved the problem by switching the settings in the plugin
Array to URL
enter image description here
add a comment |
up vote
0
down vote
up vote
0
down vote
Solved the problem by switching the settings in the plugin
Array to URL
enter image description here
Solved the problem by switching the settings in the plugin
Array to URL
enter image description here
answered Nov 11 at 13:32
Nikita Yakovlev
1
1
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245459%2fdisplaying-categories%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
is it just displaying a no image icon? it may be your path. do a var_dump($cat_img); to see what that outputs
– comphonia
Nov 11 at 3:25
@comphonia , it gets the number "39", where it comes from, I don't know
– Nikita Yakovlev
Nov 11 at 12:07