Forum Replies Created

Viewing 15 replies - 1 through 15 (of 19 total)
  • Forum: Hacks
    In reply to: how to convert this code?
    Thread Starter cipriano200

    (@cipriano200)

    THIS CODE WORKED

    <?php
    global $ancestor;
    $cat = $wp_query->queried_object->term_id;
    $childcats = get_terms('parchet-cats', 'parent=' . $cat . '&hide_empty=1');
    foreach ($childcats as $childcat) {
      if (cat_is_ancestor_of($ancestor, $childcat->term_id) == false){
        echo '<a class="trick product-search-item" href="'.get_term_link($childcat->slug, 'parchet-cats').'">';
    
        echo '<img src=';
        echo z_taxonomy_image_url($childcat->term_id);
        echo '>';
        echo '<div class="icon"></div>';
        echo '<span>';
        echo $childcat->name . '</span>';
        echo '</a>';
        $ancestor = $childcat->term_id;
      }
    }
    ?>
    Forum: Hacks
    In reply to: how to convert this code?
    Thread Starter cipriano200

    (@cipriano200)

    trying final code

    Forum: Hacks
    In reply to: how to convert this code?
    Thread Starter cipriano200

    (@cipriano200)

    closer, but shows all categories, not child of parent

    here: https://s14.postimg.org/ixy27qtsx/pic1.png
    and here: https://s14.postimg.org/kyolskpy9/pic2.png

    Forum: Hacks
    In reply to: how to convert this code?
    Thread Starter cipriano200

    (@cipriano200)

    LOL i’m not good at this

    Forum: Hacks
    In reply to: how to convert this code?
    Thread Starter cipriano200

    (@cipriano200)

    tried this but failed:

    <?php
    global $ancestor;
    $childcats = get_terms('parchet-cats', 'child_of=' . $cat . '&hide_empty=1');
    foreach ($childcats as $childcat) {
      if (cat_is_ancestor_of($ancestor, $childcat->term_id) == false){
        echo '<a class="trick product-search-item" href="'.get_term_link($childcat->term_id, 'parchet-cats').'">';
    
        echo '<img src=';
        echo z_taxonomy_image_url($childcat->term_id);
        echo '>';
        echo '<div class="icon"></div>';
        echo '<span>';
        echo $childcat->term_name . '</span>';
        echo '</a>';
        $ancestor = $childcat->term_id;
      }
    }
    ?>

    Shows this error:

    Catchable fatal error: Object of class WP_Error could not be converted to string in D:\zEasyPHP-DevServer\data\localweb\decor\wp-content\themes\dd\taxonomy-parchet-cats.php on line 24

    Can you enlight me where i wrong?

    Forum: Hacks
    In reply to: how to convert this code?
    Thread Starter cipriano200

    (@cipriano200)

    Already tried that, maybe i am missing something?

    The converted code:

    <?php
    global $ancestor;
    $childcats = get_terms('child_of=' . $cat . '&hide_empty=1');
    foreach ($childcats as $childcat) {
      if (term_is_ancestor_of($ancestor, $childcat->cat_ID) == false){
        echo '<a class="trick product-search-item" href="'.get_term_link($childcat->cat_ID).'">';
    
    	echo '<img src=';
    	echo z_taxonomy_image_url($childcat->term_id);
    	echo '>';
    	echo '<div class="icon"></div>';
    	echo '<span>';
    	echo $childcat->cat_name . '</span>';
        echo '</a>';
        $ancestor = $childcat->cat_ID;
      }
    }
    ?>

    Shows this error:

    Warning: Missing argument 3 for term_is_ancestor_of(), called in URL on line 23 and defined in D:\zEasyPHP-DevServer\data\localweb\decor\wp-includes\taxonomy.php on line 1542
    
    Catchable fatal error: Object of class WP_Error could not be converted to string in D:\zEasyPHP-DevServer\data\localweb\decor\wp-content\themes\dd\taxonomy-parchet-cats.php on line 24
    Forum: Plugins
    In reply to: need custom loop code
    Thread Starter cipriano200

    (@cipriano200)

    WORKED!

    THANK YOU AGAIN

    Forum: Plugins
    In reply to: need custom loop code
    Thread Starter cipriano200

    (@cipriano200)

    How to implement into this code with li tags?

    That code works for posts

    <?php /* Time to create a new loop that pulls out image attachments for this post */
    
    $args = array( 'post_type' => 'attachment', 'posts_per_page' => -1, 'numberposts' => 999, 'post_status' => null, 'post_parent' => $post->ID, 'orderby' => 'menu_order ID', 'order' => 'ASC', );
    $attachments = get_posts( $args );
    if ( $attachments ) {
    foreach ( $attachments as $attachment ) {
    $image_attributes = wp_get_attachment_image_src( $attachment->ID, 'full' );
    
    echo '<div class="centerImg">';
    echo '<a rel="prettyPhoto-img" href="';
    echo $image_attributes[0];
    echo '">';
    echo '<img src="';
    echo $image_attributes[0];
    echo '" />';
    echo '</div>';
    
    ?>
    <?php } ?>
    <?php } ?>
    Forum: Plugins
    In reply to: need custom loop code
    Thread Starter cipriano200

    (@cipriano200)

    worked like a charm

    Great help and thank you.

    Thread Starter cipriano200

    (@cipriano200)

    anyone?

    Thread Starter cipriano200

    (@cipriano200)

    I managed a way to show specific image to the post

    The code i added on single.php:

    <?php if (in_category('uncategorized')) : ?>
    <?php include (TEMPLATEPATH . "/cat-headers/uncategorized.php"); ?>
    <?php endif; ?>

    But i have to add manually the links, also so many php files

    Why the php code is not getting the information on single.php?

    Thread Starter cipriano200

    (@cipriano200)

    not working, what are the other options to display?

    Thread Starter cipriano200

    (@cipriano200)

    Also if i put one image for all posts and categories in header2.php the url loads i dont know why the code <?php echo category_description(); ?> doesnt work for posts

    Thread Starter cipriano200

    (@cipriano200)

    Codes used:
    functions.php

    //removes category description <p>
    remove_filter('term_description','wpautop');

    header2.php
    <div style="background: url('<?php echo category_description(); ?>') no-repeat scroll center top transparent;" class="sub-banner">

    So:
    category.php puls the url but single.php doesnt
    I see in page source no puled url for posts
    In category description i use normal url starting with http, as you see works only for categories

    The THEME is converted from html

    Maybe not work because i dont use reset query?

    Forum: Plugins
    In reply to: how to combine 2 php codes
    Thread Starter cipriano200

    (@cipriano200)

    Solved, used this code

    <?
    $galleryId = get_post_meta($post->ID, "slideshow", true);
    if($galleryId) {
    echo do_shortcode('[nggallery id=' . $galleryId . ']');
    }
    ?>
Viewing 15 replies - 1 through 15 (of 19 total)