Info
- 5 posts
- 3 voices
- Started 2 years ago by infected
- Latest reply from ootes
- This topic is resolved
Arguments before and after a php tag
-
- Posted 2 years ago #
Hi!
First of all, sorry for my bad english... I try to explain my intention as good as i can.
I tried to show this " | " before or after a php tag in my own template. For example my post.php contains this code
<div class="poststuff"><?php printf( __('Posted %s ago'), bb_get_post_time() ); ?> <a href="<?php post_anchor_link(); ?>">Permalink</a> <?php post_ip_link(); ?> <?php post_edit_link(); ?> <?php post_delete_link(); ?></div>What i want is that e.g. before <?php post_ip_link(); ?> is displayed the above mentioned character. If i insert it before the php tag it also displayed to "normal users". Normally the ip link is only displayed for admins. And so i´d like to see the | only as admin.
The output for normal users should look like this: Posted 38 minutes ago | Permalink
The output for admins should look like this: Posted 38 minutes ago | Permalink | 127.0.0.1 | Edit | DeleteIf i add this "|" manually before the tags, for normal users it looks like this: Posted 38 minutes ago | Permalink | | |
Any ideas how this can be done?
-
- Posted 2 years ago #
functions.bb-template.php line 1866 shows the arguments that this functions can accept, including a before and after character. But it also states
$args = null. You could add the | on line 1868 but this is editing the core :(Alternatively use an
if ( bb_current_user_can( 'view_by_ip' ) ) { echo " | "; }. -
- Posted 2 years ago #
Hm... That might be work. But there´s no way to handle this like in wordpress? For example you can pass arguments before and after the tag and also define a separator. Like this:
<php the_tags('Tags:', ', ', ''); ?> -
- Posted 2 years ago #
I figured it out.
<?php post_ip_link( array( 'before' => ' | ', 'after' => ' | ' ) ); ?> -
- Posted 2 years ago #
thanx just what i needed
-
You must log in to post.