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:



enter image description here










share|improve this question
























  • 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

















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:



enter image description here










share|improve this question
























  • 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















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:



enter image description here










share|improve this question















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:



enter image description here







php wordpress






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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




















  • 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














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






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    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

























    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






    share|improve this answer

























      up vote
      0
      down vote













      Solved the problem by switching the settings in the plugin
      Array to URL
      enter image description here






      share|improve this answer























        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






        share|improve this answer












        Solved the problem by switching the settings in the plugin
        Array to URL
        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 11 at 13:32









        Nikita Yakovlev

        1




        1






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Xamarin.iOS Cant Deploy on Iphone

            Glorious Revolution

            Dulmage-Mendelsohn matrix decomposition in Python