Search Results for 'code'
-
AuthorSearch Results
-
February 18, 2019 at 6:38 am #198657
In reply to: Links in new topic
Robin W
Moderatorfunction custom_bbp_has_replies($args) { $args[‘order’] = ‘DESC’; // 'ASC' (Ascending, Default), 'DESC' (Descending) return $args; }needs the apostrophies sorting on it !!
February 18, 2019 at 6:28 am #198656In reply to: Links in new topic
Oaz
Participanthere it is
function custom_bbp_has_replies($args) { $args[‘order’] = ‘DESC’; // 'ASC' (Ascending, Default), 'DESC' (Descending) return $args; } add_filter('bbp_before_has_replies_parse_args', 'custom_bbp_has_replies' ); function custom_bbp_show_lead_topic( $show_lead ) { $show_lead[] = 'true'; return $show_lead; } add_filter('bbp_show_lead_topic', 'custom_bbp_show_lead_topic' );February 18, 2019 at 6:25 am #198655In reply to: Links in new topic
Robin W
Moderatorcan you post the code you are now using
February 18, 2019 at 2:07 am #198643williamlucas
ParticipantThank you, Stephen, for sharing the examples link.Now i know where i was doing the mistake and after applying the code it work like anything.
February 15, 2019 at 8:18 pm #198608In reply to: How to implement Google AMP in bbpress?
shibaa987
ParticipantWell, this thread is pretty old and I have a way how you can enable AMP for bbpress pages.
Before going to enable AMP support you need below things:
– Code snippets plugin
– AMP pluginCreate a new code snippet and add the following code:
add_action( ‘amp_init’, ‘amp_bbpress_init’ );
function amp_bbpress_init() {
add_post_type_support( ‘topic’, AMP_QUERY_VAR );
}Read more @ How to Implement AMP on bbPress
February 15, 2019 at 5:31 am #198602In reply to: Custom Header for Forum
Robin W
Moderatorfunction rew_check_forum_root () { $forum_slug = '/'.bbp_get_root_slug().'/' ; $page_slug = $_SERVER['REQUEST_URI'] ; if ($page_slug == $forum_slug) return true ; else return false ; } if (rew_check_forum_root() ) echo 'we are at the forum root!' ;February 15, 2019 at 5:30 am #198601In reply to: if statement for forum root?
Robin W
Moderatorthis should do it
function rew_check_forum_root () { $forum_slug = '/'.bbp_get_root_slug().'/' ; $page_slug = $_SERVER['REQUEST_URI'] ; if ($page_slug == $forum_slug) return true ; else return false ; } if (rew_check_forum_root() ) echo 'we are at the forum root!' ;February 14, 2019 at 3:37 pm #198589In reply to: Links in new topic
Robin W
ModeratorI’m pretty sue that you code is suffering from apostrophe differences.
When you copy code differ3ent editors change the ‘ !
so your code has for instance
(‘bbp_before_has_replies_parse_args’,suggest you remove the start and end apostrophies and replace eg
('bbp_before_has_replies_parse_args',February 14, 2019 at 9:09 am #198574In reply to: Links in new topic
Oaz
Participanthere is all the code I have (line 614 to 626) :
function custom_bbp_has_replies($args) {
$args[‘order’] = ‘DESC’; // ‘ASC’ (Ascending, Default), ‘DESC’ (Descending)return $args;
}
add_filter(‘bbp_before_has_replies_parse_args’, ‘custom_bbp_has_replies’ );function custom_bbp_show_lead_topic( $show_lead ) {
$show_lead[] = ‘true’;return $show_lead;
}
add_filter(‘bbp_show_lead_topic’, ‘custom_bbp_show_lead_topic’ );The errors :
Notice: Use of undefined constant ‘custom_bbp_has_replies’ – assumed ‘‘custom_bbp_has_replies’’ in /home/acania/public_html/demo/wp-content/themes/woffice-child-theme/functions.php on line 619
Notice: Use of undefined constant ‘bbp_show_lead_topic’ – assumed ‘‘bbp_show_lead_topic’’ in /home/acania/public_html/demo/wp-content/themes/woffice-child-theme/functions.php on line 626
Notice: Use of undefined constant ‘custom_bbp_show_lead_topic’ – assumed ‘‘custom_bbp_show_lead_topic’’ in /home/acania/public_html/demo/wp-content/themes/woffice-child-theme/functions.php on line 626
In fact answers are not inverted anymore…
February 14, 2019 at 9:02 am #198573In reply to: Links in new topic
Robin W
Moderatorhmmm…
1. did you leave in the code, from what you say that is needed as well
function custom_bbp_show_lead_topic( $show_lead ) { $show_lead[] = ‘true’; return $show_lead; } add_filter(‘bbp_show_lead_topic’, ‘custom_bbp_show_lead_topic’ );on your other errors, can you post lines from say 615-630 from your functions file
February 14, 2019 at 8:57 am #198572In reply to: Links in new topic
Oaz
ParticipantHi Robin and thanks for your answer,
I tried with your code, and :
replies are inverted but I cannot see the Topic itself anymore, only answers
– I have this handful of mistakes appearing
f undefined constant ‘custom_bbp_has_replies’ – assumed ‘‘custom_bbp_has_replies’’ in /home/acania/public_html/demo/wp-content/themes/woffice-child-theme/functions.php on line 620
Notice: Use of undefined constant ‘bbp_before_has_replies_parse_args’ – assumed ‘‘bbp_before_has_replies_parse_args’’ in /home/acania/public_html/demo/wp-content/themes/woffice-child-theme/functions.php on line 621
Notice: Use of undefined constant ‘custom_bbp_has_replies’ – assumed ‘‘custom_bbp_has_replies’’ in /home/acania/public_html/demo/wp-content/themes/woffice-child-theme/functions.php on line 621
Notice: Use of undefined constant ‘bbp_show_lead_topic’ – assumed ‘‘bbp_show_lead_topic’’ in /home/acania/public_html/demo/wp-content/themes/woffice-child-theme/functions.php on line 628
Notice: Use of undefined constant ‘custom_bbp_show_lead_topic’ – assumed ‘‘custom_bbp_show_lead_topic’’ in /home/acania/public_html/demo/wp-content/themes/woffice-child-theme/functions.php on line 628
I am not a developper, so I do not know what to do with these
February 14, 2019 at 8:41 am #198571In reply to: Links in new topic
Robin W
Moderatoryour first bit of code should be
function custom_bbp_has_replies($args) { $args[‘order’] = ‘DESC’; // ‘ASC’ (Ascending, Default), ‘DESC’ (Descending) return $args; } add_filter(‘bbp_before_has_replies_parse_args’, ‘custom_bbp_has_replies’ );The ($args) brings in all the existing args and then your next line modifies just the ‘order’ arg. Otherwise the only argument passed to the query is the ‘order’ arg, so there is nothing to display.
February 14, 2019 at 4:57 am #198561In reply to: email notification to “noreply”
Robin W
ModeratorGreat – glad you are fixed, and for anyone reading this later the code should be
add_filter ('bbp_get_do_not_reply_address', 'rew_no_reply') ; function rew_no_reply ($no_reply) { $no_reply = 'abc@def.com' ; return $no_reply ; }February 13, 2019 at 8:07 pm #198557In reply to: email notification to “noreply”
rhodesengr
ParticipantI fixed it. Needed single quotes around the email address. I don’t uslly code much in php so I am not super on top of the syntax. Thanks for the code. Now it does just what I want. Only the admin email gets notified when someone posts. That is what i want for now. Thanks again.
February 13, 2019 at 7:46 pm #198556In reply to: email notification to “noreply”
rhodesengr
ParticipantI tried your code snipet and it killed my site. I commented it back out and the site is working again. here is exactly what I put in functions.php except i changed the actual email name to “myemail”
add_filter (‘bbp_get_do_not_reply_address’, ‘rew_no_reply’) ;
function rew_no_reply ($no_reply) {
$no_reply = myemail@gmail.com ;
return $no_reply ;
}February 13, 2019 at 5:30 pm #198554In reply to: email notification to “noreply”
rhodesengr
Participantok thanks. I am trying the asynchronnous one first. Not really sure what it is doing. Now it seems like no email gets sent at all. Not to noreply, not to the poster, and not to site admin. I have asked about this on that plugin support page.
Your code snippet goes in functions.php?
February 13, 2019 at 5:11 pm #198553In reply to: email notification to “noreply”
Robin W
Moderatorby default bbpress send one email to the noreply address and bcc’s in the subscibers, so only one email sent.
code to change
add_filter ('bbp_get_do_not_reply_address', 'rew_no_reply') ; function rew_no_reply ($no_reply) { $no_reply = abc@def.com ; return $no_reply ; }You’d think the bbpress coders would have created setting for this by now
the bbpress coders are busy people who can code what they wish to. Not up to us to criticise free software
February 13, 2019 at 3:30 pm #198552In reply to: email notification to “noreply”
rhodesengr
Participantok. thanks. What are “individual emails”
Also, is there a reference to how to change the code? I would like to consider that option.
I searched and found some other threads about this issue. One was from 2016. You’d think the bbpress coders would have created setting for this by now. Seems a lot of plugins have problems if you don’t have an enmail address with the website domain but it is very commone to use the built in system, your own pop, or gmail. Then the noreply@yourdomain.com is invalid. Common and forseeable.
February 13, 2019 at 1:53 pm #198550In reply to: email notification to “noreply”
Robin W
Moderatorbbpress sends an email to the noreply address and bcc’s in the intended recipients.
2 solutions
1. my style pack plugin lets you amend the ‘to’ address (see email subscriptions tab), or you can do this with code, and amend it to a real address on your website.
2.switch to individual emails – this plugin does that https://wordpress.org/plugins/asyncronous-bbpress-subscriptionsFebruary 12, 2019 at 8:45 pm #198534manuuu1127
ParticipantI looked through all the entries and didn’t find the answer. Maybe if someone else goes searching they will see my answer.
If you remove the sidebar and change your page to full-width it won’t work…buttt if you create a new page and set it as full width and then put the bbpress code into it, it will go full width. My only thing now is I will probably install a plug in to put sidebars where I want them
February 12, 2019 at 6:30 pm #198532In reply to: All Forums not showing
Robin W
Moderatorput this in your functions file, or code snippets
//Number of forums per page
add_filter (‘bbp_before_has_forums_parse_args’, ‘rew_number_of_forums’) ;#function rew_number_of_forums ($args) {
$args[‘posts_per_page’] = 100 ;
return $args ;
}February 12, 2019 at 3:29 am #198512In reply to: increase font size
Robin W
Moderatoras per op
What I did,
1. installed Simple Custom CSS plugin – all ok
2. insert the below code. and changed the font-size: 1.1em; to 1.6emFebruary 11, 2019 at 7:02 pm #198504In reply to: increase font size
unionhost
Participanthello,
I don’t understand where do we have to copy-paste this code please ?
I’m looking for increasing the size of the font forum; thanksFebruary 10, 2019 at 3:12 pm #198450In reply to: Custom Breadcrumbs (what URL to use for forum)
Robin W
ModeratorI’d suggest you do this as follows:
there is a ‘hook’ that you show above called ‘<?php do_action( ‘bbp_template_before_single_topic’ ); ?>’
This tells bbpress to do any action that is added at that point.
so adding a hook will mean that the function is called at that point.
The following code should go in your child theme functions file, or use the code snippets plugin
add_action ( 'bbp_template_before_single_topic' , 'rew_back' ); function rew_back () { $text = 'click to go back' ; if (bbp_get_topic_forum_id() == '25') $href = home_url( '/forum/domestics/' ) ; if (bbp_get_topic_forum_id() == '33') $href = home_url( '/forum/commercial/' ) ; //where to go if page not there else $href = home_url( '/login/' ) ; echo '<a class="button" href ="'.$href.'">'.$text.'</a>' ; }so each forum will need a line.
February 8, 2019 at 5:48 am #198389Topic: Custom Breadcrumbs (what URL to use for forum)
in forum ThemesMichael
ParticipantHello,
I’ve been having issues with breadcrumbs, and gone through various mechanisms to get them working efficiently with no joy.
My needs are simple, so looking to create a simple button in my single topic template to go back to the forum the topic is a part of.
Can anyone suggest the best URL and code to use?
/ Background:
– I have created multiple single forums
– I have then created multiple WP pages, and used the single forum shortcode to embed the forum in the page
– I’d like to include one button at the top of the topic, that simply takes the user back to the relevant page that is hosting that particular forum (not the bbP forum page)/ Location of code:
I am guessing (non-coder) that the best location for this code would be as follows (within content-single-topic.php). Is this correct? (see code below)
<?php/**
* Single Topic Content Part
*
* @package bbPress
* @subpackage Theme
*/?>
/* BUTTON HERE */
<div id="bbpress-forums">
<?php bbp_breadcrumb(); ?>
<?php do_action( 'bbp_template_before_single_topic' ); ?>
Cheers,
Michael
-
AuthorSearch Results