• Resolved distrait

    (@distrait)


    Hello,
    Thank you for this needfull plugin.
    I would like very much each side-note to begin (or end) with a link back to the main text : A link that send the reader back to where it come from.
    I made it my own (and probably dirty) way. The following line are copied from my customized version, starting line 476.

    `<?php
    foreach ( $this->notes as $note_id => $note_text ) {
    // $note_text = wpautop( $note_text );
    // usage de la fonction désactivée : Re-enclose notes in paragraph tags to fix any shortcode-caused weirdness
    // ?>
    <li id=’note-<?php echo $note_id ?>’ class='<?php echo $class ?> <?php echo $class ?>-note <?php echo $class ?>-note-<?php echo $note_id ?>’ <?php echo $type_attr ?>><div class='<?php echo $class ?> <?php echo $class ?>-text <?php echo $class ?>-text-<?php echo $note_id ?>'<?php echo $text_color_attr ?>><p><?php echo $note_text ?> <a href=”#ref-<?php echo $note_id ?>” title=”retour à l’envoyeur”> ↑ </a></p></div></li>
    <?php
    }
    ?>`

    As you see I had to deactivate wpautop.
    I am sure things can be done in a smarter way.

    Regards

    http://wordpress.org/plugins/side-matter/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author setzer

    (@setzer)

    Hi distrait,

    You can indeed do this without disabling wpautop, which is a good idea as broken <p> tags tend to crop up without it.

    Try this:

    <?php
    foreach ( $this->notes as $note_id => $note_text ) {
    	$note_text .= " <a href='#ref-{$note_id}' title='retour à l’envoyeur'>↑</a>"; // Append arrow link to note
    	$note_text = wpautop( $note_text ); // Re-enclose notes in paragraph tags to fix tags broken by shortcode
    	?>
    	<li id='note-<?php echo $note_id . $append_list ?>' class='<?php echo $html_class ?> <?php echo $html_class ?>-note'>
    		<div class='<?php echo $html_class ?> <?php echo $html_class ?>-text'<?php if ( $options['user_colors']['colors_enabled'] ) echo " style='{$text_color_style}'" ?>>
    			<?php echo $note_text ?>
    		</div>
    	</li>
    	<?php
    }
    ?>

    Thread Starter distrait

    (@distrait)

    Thank you !
    Will you add it in the next version ?

    Plugin Author setzer

    (@setzer)

    Glad to help. I’ll take a look at adding this as an optional feature in a future release.

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

The topic ‘Link back to text’ is closed to new replies.