Search Results for 'code'
-
AuthorSearch Results
-
July 11, 2014 at 10:18 am #148986
In reply to: Reduce size of embed Media
Leonyipa
Participantyes, but it doesn’t work π
I also found the code is in
/public_html/wp-content/plugins/bbpress/templates/default/css/bbpress.cssI directly change the number of
#bbpress-forums div.bbp-topic-content img,
#bbpress-forums div.bbp-reply-content img {
max-width: 100%;
}
However, no matter what number I change to, it still doesnβt work.
The width of the image still remain 100%July 11, 2014 at 8:17 am #148984In reply to: Reduce size of embed Media
Robkk
Moderatorchange the numbers to whatever you want
#bbpress-forums div.bbp-reply-content img, #bbpress-forums div.bbp-topic-content img { max-width: 500px; max-height:250px; height: auto; }you add this into anywhere where you can have custom css
in bbpress.css in your child theme(you copy the original in your child theme)
in your child themes css stylesheet
the jetpack plugin module custom css
a standalone custom css pluginJuly 11, 2014 at 3:20 am #148973In reply to: Simple Layout
Robin W
Moderatorok, several ways you could do this, the best I know is
https://wordpress.org/plugins/display-posts-shortcode/
just create a page called anything and put the code on it.
you’ll be looking for a custom post type of topic.
see https://github.com/billerickson/display-posts-shortcode/wiki for the arguments you can use
you can then determine exactly what you display
but something like
[display-posts post_type=”topic” posts_per_page=”15″]
would give a simple list of 15 clickable topic titles per page.
July 10, 2014 at 6:59 pm #148961In reply to: Troubleshooting a WordPress page titled 'forums'
Stephen Edgar
KeymasterOoops, missed the 2.3.2 π
I should have said in my previous reply, any conflicting permalinks ‘except’ a page titled
forums, indeed using a page titledforumswith a shortcode should work just fine.As you have changed the slug on that conflicting page now could you try creating a new page
forumsand adding whatever shortcode your using to it, what happens?Note: I’m splitting this topic to it’s own also as this is a different issue from the original topic.
July 10, 2014 at 6:20 pm #148959In reply to: Need to change the color of hyperlinks
Robkk
Moderatorwell you should change your sitewide hyperlink color because you want people to see links you post.
for topics
a.bbp-topic-permalink { color:#222; }for forums
a.bbp-forum-title { color:#222; }July 10, 2014 at 6:16 pm #148958In reply to: Troubleshooting a WordPress page titled 'forums'
Paul
ParticipantHi Stephen, my upgrade was 2.3.2 to 2.5.4 not 2.5.3 to 2.5.3.
You were correct, thank you. The problem was caused by a permalink conflict. The page I am using the shortcode had the slug
forums. Changing the slug to something else so it was not the same as the slug used by Forum Root (or visa versa) resolved the issue.The question remains though, why is this a problem with this version of bbpress over the older version I was using?
July 10, 2014 at 6:04 pm #148953In reply to: Need to change the color of hyperlinks
Robkk
Moderatorok this changes the style of all the links on your site so it is not white (i copied googles link color)
a { color: #3a84df; }a:hover { color: #3a84df; text:decoration: underline; }you add this into anywhere where you can have custom css
in your child themes css stylesheet
the jetpack plugin module custom css
a standalone custom css pluginJuly 10, 2014 at 5:51 pm #148951In reply to: Need to change the color of hyperlinks
Robkk
Moderatora { color: #676768; }try that
July 10, 2014 at 5:11 pm #148947Jerry
ParticipantI have updated the code again, and I have a question to improve it a little. First the update; I had more trouble with formatting when I wanted to bring in topics from different sites. What I finally learned was to create a new id class and use it in my child theme style.css. 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' => 8 ) ) ) { //id class to be named "#recent-titles li.bbp-topic-title" and placed in style.css in the child theme ?> <ul id="recent-titles"> <?php while ( bbp_topics() ) : bbp_the_topic(); ?> <?php bbp_get_template_part( 'loop', 'single-topic' ); ?> <?php endwhile; ?> <?php //bbp_get_template_part( 'loop', 'topics' ); ?> </ul> <?php //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; }And here is what I added to style.css:
/*Changes made to accommodate formatting for plugin recent-bbpress-changes*/ #recent-titles li.bbp-topic-title { float: left; text-align: left; width: 12%; overflow: hidden; }Notice how I declared the class id in the php code. One additional note; I have made several changes to my bbpress topics before I ever implemented this plugin. Perhaps other users will not require the css changes that I had to implement, post plugin activation.
Now for my question: Is it possible to have two input parameters to a shortcode? For this plugin, I would like to be able to change the input to “post_parent” as well as “switch_to_blog($attr[‘id’]);”. I’ve already tried to do this, but have failed. Here is what I tried:
function recent_bbpress_topics($attr,$attr2) { //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' => $attr2['id2'], 'posts_per_page' => 8 ) ) )I end up getting an illegal string swap error. Anyone got any ideas here?
July 10, 2014 at 4:06 pm #148940In reply to: Theming Question
Robin W
Moderatorstart with
July 10, 2014 at 12:53 pm #148938In reply to: Forum index
Robkk
Moderatori also forgot that buddypress uses a nav id of #subnav but thats easy to fix just change subnav to bbnav
so all the code would be
to register the menu
function register_menu() { register_nav_menu('bbmenu', __('bbpress Forum Menu')); } add_action('init', 'register_menu');place this below
<?php do_action( 'bbp_template_before_forums_loop' ); ?><nav id="bbnav" role="navigation"> <?php if ( has_nav_menu( 'bbmenu' ) ) { /* if menu location 'bbmenu' exists then use custom menu */ wp_nav_menu( array( 'theme_location' => 'bbmenu') ); } ?> </nav>now add custom css
#bbnav ul { font-size: 13px; list-style: none; margin: 0; } #bbnav li { list-style-type: none; display: inline-block; margin: 6px 4px; } #bbnav a { text-decoration: none; color: #555; background: #ddd; padding: 2px 8px; border: 1px solid #e4e4e4; } #bbnav li a:hover { background: #333; color: #fff; border-color: transparent; text-shadow: none; }ok i found a css way of showing the menu only on the forum archive page
create a page called forums that leads to the forum archive
now make sure to grab the page id
heres how to get the page id
now add this css , replace (#) with the page number id for the forum archive page
.post-# #bbnav { background: none; clear: both; display: block; float: left; margin: 0 auto 6px; width: 100%; } #bbnav { display: none; }now it should only show on the forum archive page only
not in subscribed forums anymore
if you dont see the menu , you probably need a special way to register menus for your theme
July 10, 2014 at 9:38 am #148935In reply to: Reduce size of embed Media
Robkk
Moderatorhere use this code instead and remember put this into your functions.php in your child theme
change the numbers to whatever you wantadd_filter('embed_defaults','themename_embed_defaults'); function themename_embed_defaults($defaults) { $defaults['width']=500; $defaults['height']=250; return $defaults; }July 10, 2014 at 8:38 am #148932Robin W
Moderatoryou shouldn’t be changing directly !
can you come back and post your code for 2, you’ve just missed a “‘” somewhere I expect.
July 10, 2014 at 8:32 am #148931In reply to: Reduce size of embed Media
Robkk
Moderator@leonyipa ok great on the youtube video width , at least the code is doing something
there is probably another function on the web that i can direct you to if i find something that works on both height and width, so wait til i come back with a function that works for both
if i give you a new function delete the old one
paste codes into a child themes functions.php and style.css so that the code wont disappear during theme upgrades
and dont edit the core files inside of bbpress
copy those files into your child theme so you can be safe on bbpress plugin upgradesso copy bbpress.css to your child theme, if you dont have a child theme , make one they are great for customizing your bbpress install
for more about customizing bbpress with css , plugins, and functions read this
July 10, 2014 at 7:56 am #148927In reply to: phpBB Import Error(s)
Stephen Edgar
KeymasterYou wrote in your previous post:
Sure thing, Iβll see what I can dig out. Iβm going to be running the import a few more times over the coming weeks anyway because I need to make sure that I have the process down to a t before we decide to go live.
Does this mean you have now gone live and a ‘few more imports’ has already happened and ‘coming weeks’ is time flies when having fun?
You should find in your
wp_postmetatable primarily two reference meta keys,_bbp_old_forum_idand_bbp_old_topic_idIn the case below the new forum ID in
wp_postsis8789for the old phpBB forum ID53and the new topic id in inwp_postsis8803for the old phpBB topic id25743meta_id post_id meta_key meta_value 57514 8789 _bbp_old_forum_id 53 57626 8803 _bbp_old_topic_id 25743With the above data in hand you should be able to map all your old phpBB forums and topic ID’s to the new bbPress forum and topic ID’s.
July 10, 2014 at 7:31 am #148926Leonyipa
Participanthi, sorry for the late reply.
I tried both ways:
1) changing the Participant role directly
// Participant/Default
case bbp_get_participant_role() :
default :
$caps = array(// Primary caps
‘spectate’ => true,
‘participate’ => true,// Forum caps
‘read_private_forums’ => true,// Topic caps
‘publish_topics’ => true,
‘edit_topics’ => true,
‘delete_topics’ => true,// Reply caps
‘publish_replies’ => true,
‘edit_replies’ => true,
‘delete_replies’ => true,// Topic tag caps
‘assign_topic_tags’ => true,
);break;
}after I changed it, nothing happened :/
and
2) making custom role, but it says:Parse error: syntax error, unexpected ‘roles’ (T_STRING), expecting ‘(‘ in /home/gleam/public_html/wp-content/plugins/bbpress/includes/core/capabilities.php on line 216
216: function add_new roles( $bbp_roles ) 217: {July 10, 2014 at 7:08 am #148924In reply to: Reduce size of embed Media
Leonyipa
ParticipantI also found the code is in
/public_html/wp-content/plugins/bbpress/templates/default/css/bbpress.cssI directly change the number of
#bbpress-forums div.bbp-topic-content img,
#bbpress-forums div.bbp-reply-content img {
max-width: 100%;
}However, no matter what number I change to, it still doesn’t work.
The width of the image still remain 100%July 10, 2014 at 6:55 am #148923In reply to: Reduce size of embed Media
Leonyipa
ParticipantThanks very much @Robkk!!
The youtube video worked!!! I have been looking for the solution for a long time, thanks!
The maximum width of youtube video works really well!!However, when I change the code to height, it doesn’t work π
Also for the image, I edited the css
because I am using BBPress Default Theme, it doesn’t have a .css and tell me to edit function.php instead
And I paste the code into: /public_html/wp-content/themes/bp-default/functions.php#bbpress-forums div.bbp-reply-content img, #bbpress-forums div.bbp-topic-content img {
max-width: 100%;
height: auto;
}but no matter what I change the number, it is still set to 100%.
Did I add the code to the wrong place? or it’s not working?July 10, 2014 at 2:55 am #148914In reply to: Troubleshooting a WordPress page titled 'forums'
Stephen Edgar
Keymaster@pplumridge I can’t see how any of the differences in code from 2.5.3 to 2.5.4 could have broken this.
Any chance it’s a permalink conflict? Do you have any posts, pages, maybe even forums or topics using
forumsas the slug? (Also check the ‘trash’ folders to make sure the post/page isn’t there)July 9, 2014 at 7:35 pm #148909In reply to: query_posts topic content – private forum
acornale
ParticipantCorrect. The forums are currently private. When I’m logged in, the feeds work fine but for non-logged in users, they see blank boxes.
This is the code I’m using to display the latest 4 topics:
<?php query_posts( array( ‘post_parent’ => ’89’, ‘post_type’ => ‘topic’, ‘posts_per_page’ => ‘4’, ‘order’ => ‘DESC’, ‘offset’ => ‘0’ ) );?>
<?php if(have_posts()):while(have_posts()):the_post();?><div class=”home-forum-single”>
<span class=”entry-date”><?php echo get_the_date(); ?></span>
<?php the_title();?></div><!– end home forum single –>
<?php endwhile;?>
<?php endif;?>
<?php wp_reset_query(); ?>—
There’s also a <?php the_permalink();?> wrapped around the title above but every time I enter it in the box, it converts it to a link so I’ve taken it out for now.
Also, the “post_parent” in the query is the private forum.
July 9, 2014 at 5:09 pm #148901In reply to: Need help changing text color in posts
Robin W
Moderatorstart with
July 9, 2014 at 3:29 pm #148898In reply to: Import phpbb3 custom profile fields
Stephen Edgar
KeymasterThe current phpBB importer only imports ‘extra’ user fields from the
phpbb_userstable.The following custom profile fields are what is currently imported, we store these in
wp_usermeta// Store ICQ (Stored in usermeta) 'from_fieldname' => 'user_icq', // Store MSN (Stored in usermeta) 'from_fieldname' => 'user_msnm', // Store Jabber 'from_fieldname' => 'user_jabber', // Store Occupation (Stored in usermeta) 'from_fieldname' => 'user_occ', // Store Interests (Stored in usermeta) 'from_fieldname' => 'user_interests', // Store Signature (Stored in usermeta) 'from_fieldname' => 'user_sig', // Store Location (Stored in usermeta) 'from_fieldname' => 'user_from', // Store Avatar Filename (Stored in usermeta) 'from_fieldname' => 'user_avatar',The current implementation needs to explicitly named fields to import them, so having the import support custom named fields is not available to be used at this time, one day hopefully.
With that said, with a list of fields names and the tables the fields are stored in these can easily be added to a customized phpBB importer.
As to where to send these fields, if you are using BuddyPress, XProfile would be the ideal place to have these. Our importer doesn’t handle this though, again, maybe one day we can add something in BuddyPress to import ‘extra’ profile fields from bbPress. Probably the key thing here is we can get all your phpBB profile fields imported into
wp_usermetaand then with a bit of MySQL these could be copied over to the BuddyPress XProfile table and everything would be awesome. πEDIT: As all I’ve been doing the past ~5 days is working on the importers we do actually store the old phpBB
user_idso mapping the old users after an import back to the old phpBB database should also not be an issue once bbPress 2.6 is released πJuly 9, 2014 at 7:24 am #148894In reply to: query_posts topic content – private forum
Robin W
ModeratorI presume the forums are currently private?
What code are you using to display the latest 4 topics
July 9, 2014 at 6:59 am #148892Jerry
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.
-
AuthorSearch Results