• Resolved wayne christian

    (@wayne-christian)


    Hi
    Great plugin and documentation, however im not sure if this is me or the plugin filter not working correctly.

    I am using a custom post type and want to show all the related categories set up in its taxonomy. I used some code form this support but the $post var has not data. I have made it work by hacking a few things but did not want to that.

    I am running a filter prior to stop all attached images which post->ID gets the id however the tiles by line brings back nothing.

    add_filter( ‘wp-tiles-byline’, ‘view_tile_byline_filter’ );
    function view_tile_byline_filter( $byline, $post ) {
    return my_get_the_id_function($post->ID);
    //$post->ID always seem to be a blank or null

    }
    function my_get_the_id_function($id){
    $terms = get_the_terms($id, ‘type’ );
    if ($terms && ! is_wp_error($terms)) :
    $term_slugs_arr = array();
    foreach ($terms as $term) {
    $term_slugs_arr[] = $term->slug.’
    ‘;
    }
    $terms_slug_str = join( ” “, $term_slugs_arr);
    endif;
    $byline = $terms_slug_str;
    return $byline;
    }

    Is it me or the Plugin?

    Thanks

    W

    https://www.ads-software.com/plugins/wp-tiles/

Viewing 1 replies (of 1 total)
  • Plugin Author Mike Martel

    (@mike_cowobo)

    Hi Wayne,

    Set the fourth argument of add_filter to the number of arguments, otherwise it will only pass 1 argument.

    PHP should have thrown a warning that view_tile_byline_filter expects 2 arguments but only got 1. Check your error log and alternatively enable error logging / display for future debugging!

    So the solution should be to change the first line to
    add_filter( 'wp-tiles-byline', 'view_tile_byline_filter', 10, 2 );

    Let me know if that worked!

    Cheers,
    Mike

Viewing 1 replies (of 1 total)
  • The topic ‘wp tilesbyline function’ is closed to new replies.