Search Results for 'code'
-
AuthorSearch Results
-
February 1, 2021 at 10:14 am #218014
neon67
ParticipantThe easiest way is to install the GD attachments plugin – and in the settings note something like
a class = ”my-class” rel = ”prettyPhoto”
In addition, your WP must have a lightbox mechanism on board – there are many lightbox plugins in the repository. This script will to command light box style when you click on the picture.But I went the other way – I added a class with a new relay through the filters – and the lightbox mechanism is already built into my bbp-theme. This also works.
February 1, 2021 at 12:08 am #218000In reply to: Shortcodes not working (wp-poll)
chieleijt
ParticipantFound it. Download the plugin: bbpress do shortcodes
February 1, 2021 at 12:01 am #217999In reply to: Shortcodes not working (wp-poll)
chieleijt
ParticipantBut where can you enable shortcodes? I also have this problem with the polls.
January 30, 2021 at 5:49 pm #217987In reply to: Show a list of forum moderators
athep
ParticipantFor anyone looking for a solution, it’s as simple as calling
<?php echo '<pre>'; print_r(bbp_get_moderators(bbp_get_forum_id())); echo '</pre>'; ?>Or you could
echo bbp_get_moderator_list(bbp_get_forum_id());for a simple list of moderators. Remember to put it inside the loop!January 30, 2021 at 8:46 am #217980In reply to: How can I get topic’s picture URL?
Julia
ParticipantI could get the code to set on the thumbnails in the topic index page using GD bbPress Attachments.
function action_bbp_topic_row_actions() { $medias = get_attached_media( 'image', bbp_get_topic_id() ); foreach($medias as $media){ the_attachment_link( $media->ID,false ); } } add_action( 'bbp_theme_before_topic_title', 'action_bbp_topic_row_actions', 10, 0 );January 30, 2021 at 7:20 am #217979In reply to: How can I get topic’s picture URL?
Julia
ParticipantAdd other method.
I have succeeded to set the images on topic index page.
but I have no idea to change images to thumbnails.Do you have any ideas for thumbnails?
function action_bbp_topic_row_actions() { if ( have_posts() ) while ( have_posts() ) : the_post(); $medias = get_attached_media( 'image', bbp_get_topic_id() ); foreach($medias as $media){ the_attachment_link( $media->ID ); } endwhile; } add_action( 'bbp_theme_before_topic_title', 'action_bbp_topic_row_actions', 10, 0 );January 30, 2021 at 3:35 am #217974Topic: Show a list of forum moderators
in forum Troubleshootingathep
ParticipantHello,
I’m trying to get a list of the current forum’s moderators, I have this argument that filters all the users and lists me all the moderators from all the other forums.
$args = array( 'role' => 'bbp_moderator');The above code lists all of the moderators from all the forums, I only want the moderators of the current forum, any parameters or snippet that could help me?
January 29, 2021 at 9:14 pm #217973Topic: How can I get topic’s picture URL?
in forum InstallationJulia
ParticipantThe bbress Support 7 years ago. Topic Thumbnails?
add_action( 'bbp_theme_before_topic_title', 'assylumn_insert_thumbnail' ); function assylumn_insert_thumbnail() { echo('<a href="http://www.mysite.com/wp-content/uploads/2013/09/picture.jpg">') ; echo('<img class="bbp-topic-thumbnail" width="100%" style="max-width: ' . get_option('thumbnail_size_w') . 'px; max-height: ' . get_option('thumbnail_size_h'). 'px; vertical-align:middle;" src="http://www.mysite.com/wp-content/uploads/2013/09/picture.jpg"/>' .'</a>'); }I did not know how to get the url in each topic pictures using plugin, GD bbPress Attachments.
Please show me other code to get the url in the topic pictures.January 28, 2021 at 5:18 pm #217949In reply to: change styling if freshness less than 24 hours
Robin W
Moderatoryes, strtotime(‘now’) will pick up gmt, so needs adjusting, you night want to look at
$now = date_create( date_i18n( 'Y-m-d H:i:s' ) );January 28, 2021 at 3:20 pm #217947In reply to: change styling if freshness less than 24 hours
neon67
ParticipantSo, the final css looks like this (you must put “a”)
#bbpress-forums .bbp-topic-freshness .dayfresh a { background-color : #f4ffe8 ; border: 1px dashed; color: #475656; }also 86400 looks a lot – captures the 2nd day. Perhaps need to set 23 hours. But these are little things ))
Thanks to Robin for the great code!))
I think this is a useful find for those who visit the forum once a day and immediately see how many topics have been updated in the last day.
Colored blocks are very noticeable – it’s better than straining and peering at the date numbers.January 28, 2021 at 2:57 pm #217946In reply to: change styling if freshness less than 24 hours
neon67
ParticipantThe class appeared in the code!
Moment, now I will figure out why the css does not catch it… and finally give the picture the result !…January 28, 2021 at 2:48 pm #217945In reply to: change styling if freshness less than 24 hours
Robin W
Moderatorok try this for topics in a forum
add_filter ('bbp_get_topic_freshness_link' , 'rew_check_freshness2', 10 , 5 ) ; function rew_check_freshness2 ($anchor, $topic_id, $time_since, $link_url, $title) { $last_active = get_post_meta( $topic_id, '_bbp_last_active_time', true ); $diff = strtotime('now') - strtotime($last_active) ; if ($diff<86400) { $anchor = '<span class="fresh">'.$anchor.'</span>' ; } return $anchor ; }January 28, 2021 at 2:45 pm #217944In reply to: change styling if freshness less than 24 hours
neon67
Participant#bbp-topic-8191 > li.bbp-topic-freshness in code
#bbpress-forums .bbp-topic-freshness a { in css
this is a small box with a time stamp (see pic. above) white background now
January 28, 2021 at 2:35 pm #217941In reply to: change styling if freshness less than 24 hours
Robin W
Moderatorok, that’s where it should be, and it should work.
where are you putting the code ?
January 28, 2021 at 2:15 pm #217936In reply to: change styling if freshness less than 24 hours
Robin W
Moderatorahh – think I have misunderstood now I re-read, given the post you attached to, I thought your question was regarding the freshness columm, but now I don’t know.
my code adds a class in the freshness column
<li class="bbp-forum-freshness"> <span class="fresh"><a href="http://gos.rewweb.co.uk/forums/topic/eferwer/" title="EFERWER">8 hours, 14 minutes ago</a></span>so can you explain exactly what you want to turn green?
January 28, 2021 at 1:48 pm #217929In reply to: change styling if freshness less than 24 hours
Robin W
Moderatortry this
add_filter ('bbp_get_forum_freshness_link' , 'rew_check_freshness', 10 , 6 ) ; function rew_check_freshness ($anchor, $forum_id, $time_since, $link_url, $title, $active_id) { $last_active = get_post_meta( $forum_id, '_bbp_last_active_time', true ); $diff = strtotime('now') - strtotime($last_active) ; if ($diff<86400) { $anchor = '<span class="fresh">'.$anchor.'</span>' ; } return $anchor ; }This adds an extra span class called ‘fresh’ if the last active is less than 24 hours.
you can then style this in css eg
.fresh { background-color : green ; }January 28, 2021 at 12:19 pm #217924In reply to: Add introductory paragraph to home page of bbPress
Robin W
Moderatorthe easiest was is to create a page with the same permalink as your forum slug, so in your case ‘forums’
so create a page called ‘forums’
in the content put the html you want and follow with the shortcode
[bbp-forum-index]if you are using blocks, wordpress has a shortcode block type ‘sh’ in type and it will appear.and publish – check that it appears as
http://mysite.com/forumsand that should work
January 28, 2021 at 11:50 am #217922In reply to: Add “forum” to subject email notifications
Robin W
Moderatorin which case you would hook to
$subject = apply_filters( 'bbp_subscription_mail_title', '[' . $blog_name . '] ' . $topic_title, $reply_id, $topic_id );in bbpress 2.6.6\includes\common\functions.php line 1124 and 1291
January 28, 2021 at 11:24 am #217919In reply to: Create a link image for last post in forum
Robin W
Moderatorok,
the default display order is freshness, followed by author – you have it the other way around.
try changing the line above
add_action( 'bbp_theme_after_topic_author', 'rew_freshness_display_image');to
add_action( 'bbp_theme_after_forum_freshness_link', 'rew_freshness_display_image');January 28, 2021 at 11:11 am #217915In reply to: change styling if freshness less than 24 hours
Robin W
Moderatoryou don’t need stylepack, it’s just that the answer is different if you do !
I’ll come back with code when I get a moment 🙂
January 28, 2021 at 6:36 am #217895In reply to: Create a link image for last post in forum
Robin W
ModeratorPut this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
add_action( 'bbp_theme_after_topic_author', 'rew_freshness_display_image'); function rew_freshness_display_image ($forum_id = 0) { // Verify forum and get last active meta $forum_id = bbp_get_forum_id( $forum_id ); $active_id = bbp_get_forum_last_active_id( $forum_id ); $link_url = $title = ''; if ( empty( $active_id ) ) $active_id = bbp_get_forum_last_reply_id( $forum_id ); if ( empty( $active_id ) ) $active_id = bbp_get_forum_last_topic_id( $forum_id ); if ( bbp_is_topic( $active_id ) ) { //then reset forum_id to the forum of the active topic in case it is a sub forum $forum_id = bbp_get_topic_forum_id($active_id); $link_url = bbp_get_forum_last_topic_permalink( $forum_id ); $title = bbp_get_forum_last_topic_title( $forum_id ); } elseif ( bbp_is_reply( $active_id ) ) { //then reset forum_id to the forum of the active topic in case it is a sub forum $forum_id = bbp_get_reply_forum_id($active_id); $link_url = bbp_get_forum_last_reply_url( $forum_id ); $title = bbp_get_forum_last_reply_title( $forum_id ); } $anchor = '<a class="rew_freshness_display_image" href="' . esc_url( $link_url ) . '" title="' . esc_attr( $title ) . '"><img src="http://mysite.com/wp-content/uploads/2013/06/Brauhaus-2.jpg">' . '</a>'; echo '<p>'.$anchor.'</p>' ; }and change the
<img src="http://mysite.com/wp-content/uploads/2013/06/Brauhaus-2.jpg" />to the image you want – make sure it is sized right !!January 26, 2021 at 6:30 pm #217855In reply to: Using EnlighterJS inside “Quotes”
Chuckie
ParticipantIt has option to quote reply or topic. This is the shortcode I refer to.
January 26, 2021 at 6:26 pm #217854In reply to: Using EnlighterJS inside “Quotes”
Chuckie
ParticipantIf you mean blockquote then yes, but it shows asa quote shortcode. See linked discussion.
January 26, 2021 at 2:02 pm #217846In reply to: [bsp-profile] not Working for me
Robin W
Moderatorwell that’s embarassing, I hadn’t spotted that the shortcode is wrong.
It is one shortcode with parameters so should read
bsp Profile
[bsp-profile] will show ‘My Profile’ in a clickable link to the profile
[bsp-profile label=’This is the label’] will show ‘This is the label’ in a clickable link to the profile
[bsp-profile label=’Edit My Profile’ edit=’y’] will show ‘Edit My Profile’ in a clickable link to the edit section of profile
so you can have anything as the label eg label=’hello mother’
January 26, 2021 at 1:57 pm #217845In reply to: [bsp-profile] not Working for me
uksentinel
ParticipantSorry
The two shortcodes are, I assume they can work independently so does not need to work in conjunction with[bsp-profile] ?
[Profile label=’This is the label’]
[Profile label=’This is the label’]
-
AuthorSearch Results