Search Results for 'code'
-
AuthorSearch Results
-
July 9, 2014 at 6:59 am #148892
Jerry
ParticipantHi Robin. I made another improvement and added some comments. I noticed that, no matter where I inserted the shortcode, the topics displayed at the top of the content. After some searching I learned why – functions need to return a string. So I found an easy wordpress solution. I also simplified the shortcode, and removed the add_action line at the bottom as it was not doing anything. Here is the updated code:
add_shortcode( 'recent-bbpress-topics', 'recent_bbpress_topics' ); // Add Recent Topics to BBPress from separate site within WP Multisite function recent_bbpress_topics($attr) { //Switch to the blog where the bbpress topics are located switch_to_blog($attr['id']); //this, along with $response variable below, allows for display within content - without these, shortcode will display topics at top of content ob_start(); if ( bbp_has_topics( array( 'author' => 0, 'show_stickies' => false, 'order' => 'DESC', 'post_parent' => 'any', 'posts_per_page' => 9 ) ) ) { ?> <?php bbp_get_template_part( 'bbpress/loop', 'topics' ); //restore the current blog to maintain formatting restore_current_blog(); } //this, along with ob_start(); above, allows for display within content, instead of at the top of the content/page $response = ob_get_contents(); ob_end_clean(); return $response; }July 9, 2014 at 6:59 am #148891In reply to: Reduce size of embed Media
Robkk
Moderatornot sure but you probably have to set a max width for oembed embeds
http://www.wpbeginner.com/wp-themes/how-to-set-oembed-max-width-in-wordpress-3-5-with-content_width/
add the code to your functions.php in your child theme.
change 600 to whatever number you want as the width, im sure you could copy the function to width to height and also do the height to.
if the code doesnt work , look at the comments and try that user posted code. (i havent tried any of these codes so i dont know if they work really, if they dont just delete the function from your child functions.php)
for images (using img quicktag) i think you can use css
#bbpress-forums div.bbp-reply-content img, #bbpress-forums div.bbp-topic-content img {
max-width: 100%;
height: auto;
}for images (posted by link using oembed , imgur , flickr picture, instagram picture) the oembed code that i linked to should do the same for these.
July 9, 2014 at 6:00 am #148890In reply to: How to remove "Change Topic"?
Leonyipa
Participantbump please,
I tried but I cannot remove it, can you tell me which piece of code do I need to remove? Thanks
July 9, 2014 at 5:29 am #148888Topic: Possible issue untrashing topics
in forum Troubleshootingslayne76
ParticipantHi,
I run a couple of different bbpress installations, of course they’re both up-to-date (2.5.4)I noticed that on both installations, when you trash a topic, and you try to “un-trashit” you receive a nonce error.
I’m not sure if this issue depends on my personal configuration, but of course i disabled all other plugins and used a fresh wp install.
Being a PHP developer I digged inside the core files of bbpress and I noticed that in includes/topics.php on line 818 the nonce is generated with
wp_nonce_url( add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit.php' ) ) ), admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $topic->ID ) ) ), 'untrash-' . $topic->post_type . '_' . $topic->ID )so the “sent” nonce is basically untrash-topic_<ID>, while the nonce check on wordpress (on post.php line 265 is:
check_admin_referer('untrash-post_' . $post_id);or basically untrash-post_<ID>.
Can anyone tell me if other people found out a similar issue untrashing topics or is it just me? Thanks in advance for your support 🙂
July 9, 2014 at 2:54 am #148883In reply to: How to change Admin Link's text color?
Robin W
Moderatorif it’s not working try
color: #404040 !important;if bbpress loads after your theme, then it’ll overwrite changes made in your css, ie revert them back
July 9, 2014 at 2:52 am #148882In reply to: Topic Index Shortcode
Robin W
Moderatoryes, I’ve started a plugin that does some different shortcodes, and at the moment one that does just that is all that’s in there
July 8, 2014 at 7:54 pm #148879Topic: Sumbit to email address
in forum Troubleshootinglocalmarketingus
ParticipantIs there a way for me to redirect the submit button on the bbp-topic-form to an email address (like mailto:xys@whatever.com) rather than have it post a thread? I want people to be able to use the functionality of bbpress to add html and insert code if needed but want it to function more like a contact form.
Any suggestions are appreciated
July 8, 2014 at 7:38 pm #148878Topic: How to change Admin Link's text color?
in forum TroubleshootingLeafyGrove
ParticipantWhile adjusting the topics/reply color for my site, I seem to run into a bit of a snag with trying to change the admin links coloring. I’m using Catch Evolution for a theme and as such there is a area in options to put custom css code. This is what I have thus far:
” #bbpress-forums div.bbp-reply-content, #bbpress-forums div.bbp-reply-author, #bbpress-forums div.bbp-reply-header, #bbpress-forums a.bbp-admin-links { color: #404040; }
”
I do plan on having admin links a different color, I just tossed it in there to test to make sure it’s correct/changes.July 8, 2014 at 7:22 pm #148877Topic: Topic Index Shortcode
in forum Troubleshootingjoeyaberle
ParticipantIs there a way to limit how many topics show up with this shortcode? Fifteen is a little too much for our site.
Sorry if this is somewhere else, I couldn’t find it.
July 8, 2014 at 5:22 pm #148875In reply to: customizing bbpress admin links
Robkk
Moderator@robin-w (hope this doesnt confuse you anymore)
i have done that already
i added the filter to my functions.php to leave the reply links on both topic and replies
now im trying to make a drop-down menu with the rest of the other links on both topic and replies , right by the admin links by adding an html menu with the rest of the other links(trash, split, spam, etc.)
when creating a menu i use echo bbp-get-name-of-link between
lithat is between aulwhich makes a menu in html , and this shows each other admin link in a dropdown menuhowever i want the topic admin links to be on topics and the reply admin links to be on replies each in their own dropdown menu
and if i use these two functions in loop-single-reply (where i am building my menu)
-this is an example- if i use topic_reply_link and reply_tp_link it would be the same
`<?php echo bbp_get_topic_edit_link(); ?>
<?php echo bbp_get_reply_edit_link(); ?>`
there will be 1 edit link in the topic (topic_edit_link) , and two edit links in the reply (topic_edit_link and reply_edit_link)
so i have to fix the two edit links on replies when creating a dropdown menu
or find a way to make a dropdown menu using a function so that it will show two different dropdown menus for the topic and the reply
July 8, 2014 at 2:42 pm #148872In reply to: customizing bbpress admin links
Robkk
Moderator<?php if ( bbp_is_topic() ) echo bbp_get_topic_reply_link(); ?><?php if ( bbp_is_topic() ) return bbp_get_topic_reply_link(); ?>these dont show an error but it wont show the link
July 8, 2014 at 2:12 pm #148870In reply to: customizing bbpress admin links
Robkk
Moderatoroh yeah in loop-single-reply i have my admin links on the very bottom of the template and i have this code right above it
July 8, 2014 at 2:09 pm #148869In reply to: customizing bbpress admin links
Robin W
Moderatorwhere are you putting this code – is it in a bbpress template?
July 8, 2014 at 2:06 pm #148868In reply to: customizing bbpress admin links
Robkk
Moderator@robin-w i couldnt get the
if ( bbp_is_topicfunction workingi wanted to test out if i could do this , took code from this
<div class="dropdown" id="dropdown"> <input type="checkbox" id="drop1" /> <label for="drop1" class="dropdown_button">Topic Tools</label> <ul class="dropdown_content"> <li class="active"></li> <li> <?php echo bbp_get_reply_to_link(); ?></li> <li><?php if ( bbp_is_topic( $r['id'] ) ) { echo bbp_get_topic_reply_link(); ?></li> <li><?php if ( bbp_is_topic( $r['id'] ) ) { return bbp_get_topic_reply_link(); ?></li> </ul> </div>then make a dropdown menu from that i guess , but im just swinging the dark not really getting a exactly great way of doing what i want to achieve.
plus i might have to go to a jquery menu template like this
because the css menus arent working on all replies.
July 8, 2014 at 12:54 pm #148865Jerry
ParticipantAll css changes are within my child theme. For my child-theme’s style.css, I added this at the very bottom:
/*Changes made to accommodate plugin recent-bbpress-changes*/ #content ul { padding: 0; margin-left: 0; margin-right: 0; list-style: none; }For my bbpress.css in my child-theme, I added this around line 158 or so:
li.bbp-topic-title { float: left; text-align: left; width: 20%;One note on bbpress.css. The original bbpress.css had some combined lines that I separated. For example, I think that li.bbp-topic-title was combined with li.bbp-forum-info, as in the following manner:
li.bbp-forum-info, li.bbp-topic-title { float: left; text-align: left; width: 20%;But I could be wrong. Doesn’t matter. Separating them appears to be just fine.
July 8, 2014 at 12:06 pm #148861In reply to: customizing bbpress admin links
Robkk
Moderatoryou want to change the
links that come up with a topic or reply so that only some show, and others are in a dropdown list.
is that correct?
yes
This also gives you the ability to add a new link
yeah i added the topic favorite link to see if it worked and it did with the ajax too
and also a mark topic as read from the bbpress go to first unread pluginYou’ll also see that this function checks if it is a topic on line 1825
i used this as a filter for the topic admin links
//change admin links displayed function change_topic_admin_links ($r) { $r['links'] = apply_filters( 'rw_topic_admin_links', array( 'edit' => bbp_get_topic_edit_link ( $r ), 'reply' => bbp_get_topic_reply_link ( $r ) ), $r['id'] ); return $r['links'] ; } add_filter ('bbp_topic_admin_links', 'change_topic_admin_links' ) ;i tried using this function to post a single admin link for a topic
and also just by replacing return with echo
but i cant seem to get that to workif ( bbp_is_topic( $r['id'] ) ) { return bbp_get_name_of_link(); } if ( !bbp_is_reply( $r['id'] ) ) { return bbp_get_name_of_link() ; }July 8, 2014 at 11:56 am #148860In reply to: Very simple question — changing font size
Robin W
Moderatorif (is_bbpress()) : div class=”abc” else : div class=”xyz” endif;translates to
if you are on a bbpress screen/page/display [as opposed to a wordpress blog post or page, a home page or anything that isn’t bbpress]
the use div class abc
if you are on any other type of page use class xyz.
Many themes use if statements checking against ‘conditional tags’ to style areas for instance the conditional tag is_home() checks whether this is the home or index page.
July 8, 2014 at 11:10 am #148858In reply to: Very simple question — changing font size
ninjaunmatched
ParticipantOkay I found the code which is on this site actually.
But the code mentioned:
if (is_bbpress()) :
div class=”abc”
else :
div class=”xyz”
endif;Still would not make sense to everyone. So I’m thinking the first part is the main part. After the colon you would change the div class to whatever you want change which would be some of the classes mentioned in this thread to another class that you create which simply just changes the font size.
I’m thinking this way you would have to create your own classs for each thing you want to change in bbpress whether it was the reply text, the header text, or the content text. If I am off a bit or a lot just chime in. Hope it helps.
July 8, 2014 at 10:55 am #148857Jerry
ParticipantGot it solved! First, sorry for all the responses. I got lazy in posting the above instead of searching for the solution in the wordpress codex first. Turns out there is a function to return to the current blog, which I inserted within the “if” statement. Specifically, it is “restore_current_blog();”. Here is the working code:
<?php /* Plugin Name: Recent bbpress Topics Plugin URI: http://whosgotbooks.com/wp-content/plugins Description: A plugin to display recent bbpress topics across the network Version: 1.0.0 Author: Jerry Caldwell Author URI: http://whosgotbooks.com License: Open Source */ /* Here is the shortcode required [recent-bbpress-topic] */ function recent_bbpress_topics_shortcode() { recent_bbpress_topics(); } add_shortcode( 'recent-bbpress-topics', 'recent_bbpress_topics_shortcode' ); //Add Recent Topics to BBPress function recent_bbpress_topics() { switch_to_blog(9); if ( bbp_has_topics( array( 'author' => 0, 'show_stickies' => false, 'order' => 'DESC', 'post_parent' => 'any', 'posts_per_page' => 7 ) ) ) { bbp_get_template_part( 'bbpress/loop', 'topics' ); restore_current_blog(); } // Hook into action add_action('bbp_template_after_forums_loop','recent_bbpress_topics'); } ?>For anyone who wants to use this, a few more points. One, don’t forget the formatting for style.css. Two, I changed that formatting within a child theme. Three, I can’t guarantee you will have the same results with your formatting as I have made many other formatting changes the past few months for my site. Lastly, I did not “network activate” my plugin. I only activated it on the main site.
As I get time I will add comments and try to increase the functionality of this plugin. Right now it is very basic. Maybe I’ll get good enough to publish it?July 8, 2014 at 10:52 am #148856In reply to: Very simple question — changing font size
ninjaunmatched
ParticipantI know it does cascade but if you are not familiar with writting the code to STYLE over attribiutes you can go looking for lines that alter font sizes. One way you could try is to get Notepad++. This text editer is just the greatest. Never edit code without it or something like it. You can use it to search for code. In this case I would try to search for “font-size:” within the CSS file being referred to in this thread. It will find every line where the font-size is being changed.
Trying it now it finds 28 hits in the bbpress.css file I have in one of my sites. This I think will get you started. May not be the best way though. Just looking at the hits I can see some of the IDs or Classes also have a SPAN tag in them. Whichs tell me that the default span font settings would also have to be changed.
I’m not sure where your HTML knowledge is but the SPAN tag when used is like a commenting or caption section (sort of) for text and it tends to be in a smaller font.
for example:
While jumping around the hits I see this:
li.bbp-header div.bbp-topic-content span#subscription-toggle,
li.bbp-header div.bbp-topic-content span#favorite-toggle,
li.bbp-header div.bbp-reply-content span#subscription-toggle,
li.bbp-header div.bbp-reply-content span#favorite-toggle {
float: right;You may be able to get the look you want by just changing any
font-size:
entry you find but if things or some things still look too small for you then that span tag may be what you need to change to get it the way you want.
Now I’m still just maybe a intermediate in my kowledge of things. I know what I was taught by learning myself and having taken Wed Design and Development I and II at a local college. But I am no developer. So I can read through css and understand what is going on. But because of the cascading way of CSS you can make changes that will not stick due to a higher level attribute being set so you have to play detective which wastes alot of time.
I do agree though as the responses are too vague. Looking for the same answer I find this thread and so I am sharing what I have done so far to figure this one out. I did find something that mentions being able to use an IF statement on the themes main style sheet (CSS file) that will find all bbpress related entries and change whatever attribute you designate which in this case would be the font size. Now someone mentioned this in this thread without stating how which is close to pointless if the intention is to help you solve it. At least when you make the suggestion state it in a simple way so its understood by all. I ran into this code during my research on it but I am currently here. I will copy paste the code if I can find it again. By now I assume you found the answer but for anyone else that runs into this thread. (which by the way showed up on top of a google search in like its own special section).
July 8, 2014 at 10:14 am #148855Jerry
ParticipantUpdate on this. It turns out my code was insufficient. If have fixed it, sort of, which has led to another problem. First, here is the updated code:
<?php /* Plugin Name: Recent bbpress Topics Plugin URI: http://whosgotbooks.com/wp-content/plugins Description: A plugin to display recent bbpress topics across the network Version: 1.0.0 Author: Jerry Caldwell Author URI: http://whosgotbooks.com License: Open Source */ function recent_bbpress_topics_shortcode() { recent_bbpress_topics(); } add_shortcode( 'recent-bbpress-topics', 'recent_bbpress_topics_shortcode' ); //Add Recent Topics to BBPress function recent_bbpress_topics() { switch_to_blog(9); if ( bbp_has_topics( array( 'author' => 0, 'show_stickies' => false, 'order' => 'DESC', 'post_parent' => 'any', 'posts_per_page' => 7 ) ) ) { bbp_get_template_part( 'bbpress/loop', 'topics' ); } // Hook into action add_action('bbp_template_after_forums_loop','recent_bbpress_topics'); } ?>Using the line “switch_to_blog(9);” works great to get the topics from site 9 to the main site. But now my problem is; it brings some unwanted behavior. The main content looks great, but the sidebars change to the format of site 9. Perhaps this has become a wordpress issue and not a bbpress issue? Perhaps I need to use code in addition to “switch_to_blog(9);” that prevents the unwanted behavior? If I need to change this to a wordpress thread, please let me know and I will. Otherwise, if you can provide a solution, that would be great.
July 8, 2014 at 7:25 am #148854Jerry
ParticipantThanks Robin! Thanks Peter! After some trouble-shooting, the answer is as follows:
#content ul { padding: 0; margin-left: 0; list-style: none; }For some reason, if I use “ul” twice after “#content”, it doesn’t quite work.
I was using firebug, and had identified line 118 in style.css, but just didn’t make the exact connection on how to change it. I used firebug again this morning, and learned how to use it better, so thanks for leading me to a great lesson!
Robin; if you want to make this into a plugin where the user gets some options on the back-end, I will be happy to help with the grunt work and you can post it and get the credit. Just let me know, and give me some direction.
Thanks again…PS For anyone who uses this code, I made the css changes in my style.css within my Child Theme, not the main style.css.
July 8, 2014 at 5:50 am #148852In reply to: Single Forum for WP Multisite
mattmatt88
ParticipantI already have a multisite with subdomains:
myurl.com
page1.myurl.com
page2.myurl.com
page3.myurl.comNow I want, that the same forum content is used for every page.
So the same forum should be available for every page:myurl.com/forum
page1.myurl.com/forum
…For example, I’ve got a points system plugin that is multisite compatible (mycred).
I just have to set it on the main page (myurl.com) and the points logs are the same on every page. That’s what I would need for the forum.Why I need it on every page and I’m not just linking to the main page forum:
e.g. because I want to use shortcodes/widgets to show the user the most recent forum topics, doesn’t matter if he is on a subsite (e.g. page2.myurl.com/forum).Thanks a lot
July 8, 2014 at 5:33 am #148849In reply to: Remove Private Tag
Robin W
Moderatoryes put this code in your functions file
add_filter('protected_title_format', 'ntwb_remove_protected_title'); function ntwb_remove_protected_title($title) { return '%s'; } add_filter('private_title_format', 'ntwb_remove_private_title'); function ntwb_remove_private_title($title) { return '%s'; }for information on functions files see
July 8, 2014 at 3:22 am #148844In reply to: BBFacelook (work in progress)
peter-hamilton
ParticipantThanks for checking it out, is there a way you could upload an image of how it shows, and what screen resolution do you use cause my @media css is not complete.
Yep I am redoing all CSS from scratch and added the essential plugins hardcoded to make them less bulky on code.
Again I really appreciate all input to make this a reasonable theme for all to use.
Peter Hamilton
-
AuthorSearch Results