Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter R22

    (@r22)

    Thank you for your answer.

    and where could I find shortcode which can do that please?

    Thread Starter R22

    (@r22)

    Oh, never mind. I have already figured it out. I apologize for this thread, you can close it now.

    Thread Starter R22

    (@r22)

    3, I mean I want users on my site to be able to add some text about themselves, age, favourite sport etc. these kind of things.

    Thank you guys for your answers.

    Thread Starter R22

    (@r22)

    So I figured it out. The problem was I didn’t have the ‘post_type’ defined in $args for new WP_query

    It works now

    Thread Starter R22

    (@r22)

    Hi alchymyth,

    no, there is no custom taxonomy, I used taxonomy Tags, which is included in WP by default. I just assigned this default Tags taxonomy to my Custom Post Type “products” so I could use it. I hope you know what I mean.

    So basically, I want to use default ‘post_tag’.

    what is the result if you add a test output after this line:
    $taxs = wp_get_post_terms( $post->ID );
    for example with:
    var_dump( $taxs );

    The output of var_dump ($taxs; is this:

    array(2) { [0]=> object(stdClass)#2337 (9) { [“term_id”]=> string(2) “13” [“name”]=> string(5) “Tag 1” [“slug”]=> string(5) “tag_1” [“term_group”]=> string(1) “0” [“term_taxonomy_id”]=> string(2) “16” [“taxonomy”]=> string(8) “post_tag” [“description”]=> string(0) “” [“parent”]=> string(1) “0” [“count”]=> string(1) “3” } [1]=> object(stdClass)#2338 (9) { [“term_id”]=> string(2) “11” [“name”]=> string(5) “Tag 2” [“slug”]=> string(5) “tag_2” [“term_group”]=> string(1) “0” [“term_taxonomy_id”]=> string(2) “14” [“taxonomy”]=> string(8) “post_tag” [“description”]=> string(0) “” [“parent”]=> string(1) “0” [“count”]=> string(1) “3” } }

    I guess that is correct, because I added 2 tags to my custom post (‘Tag 1’ and ‘Tag 2’ are names of tags assigned to this custom post)

    Thread Starter R22

    (@r22)

    ok so I found I need to add get_field funciton in my file, so the code looks like this now:

    <?php
    
    $this_category_id=get_query_var('cat');
    $args=array(
    	'parent' => $this_category_id,
    	'orderby' => 'name',
      	'order' => 'ASC',
      	'hide_empty' => 0
      );
    
    $categories=get_categories($args);
    $image_url=get_field('obrazek_podkategorie', 'category_'. 
    
    $category->cat_ID .'');
    
    	foreach($categories as $category) {
    		echo '<img src="'. $image_url .'"/>';
    		echo '<b>'. $category->name .'</b>';
        	echo '<p>'. $category->description .'</p>';}
    ?>

    but it doesn’t work because (I think) in this function
    get_field('obrazek_podkategorie', 'category_'. $category->cat_ID .'')
    the part
    'category_'. $category->cat_ID .
    doesn’t return category ID..

    how should I fix it? any help pls?

    I have the same issue. Does anybody know how to fix it please?

    Thread Starter R22

    (@r22)

    Thank you very much 🙂

Viewing 8 replies - 1 through 8 (of 8 total)