Skip to content

Post_Tags issue #98

@epikentros

Description

@epikentros

Hi,

I found a problem trying to use the options for [Post_Tags] code.
Even if I write - links="false" - the plugin still put the link.
Following the corrected code from class-apl-shortcodes.php file.
Hope to do it right!
Thanks,
Enrico.

	public function post_tags( $atts ) {
		// INIT.
		$atts_value = shortcode_atts( array(
			'delimiter' => ', ',
			'links' => 'true',
		), $atts, 'post_tags');
		$return_str = '';

		// STEP 1.
/*		$atts_value['links'] = true; THIS IS THE PROBLEM - THEN I CHANGE IT */
		$links = true; /* STARTS FROM HERE NOW */
		if ( 'false' === strtolower( $atts_value['links'] ) ) {
			$links = false; /* HERE ANOTHER CHANGE */
		}

		// STEP 2.
		$post_tags = get_the_tags( $this->_post->ID );
		$array_total = count( $post_tags );
		$i = 1;
		if ( $post_tags ) {
			// STEP 3.
			foreach ( $post_tags as $tag ) {
				if ( $links ) { /* HERE ANOTHER CHANGE */
					$return_str .= '<a href="' . get_tag_link( $tag->term_id ) . '" >' . $tag->name . '</a>';
				} else {
					$return_str .= $tag->name;
				}

				if ( $array_total > $i ) {
					$return_str .= $atts_value['delimiter'];
				}
				$i++;
			}
		}

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2 - CriticalCauses a failure (non-breaking) and requires urgent attention.T-Defect

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions