Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 2,126 through 2,150 (of 32,466 total)
  • Author
    Search Results
  • #216579
    Tamie
    Participant

    OK Astra does not have a child theme. Now what? And what code do I use to fix this flaw?

    https://www.theshrinkingwoman.com/tswforums/

    #216570
    Robin W
    Moderator

    @neon67 – I wrote style pack because I had hundreds of code changes that did little bits and no way to control. So either it’s style pack, or you’ll need to start working out how the functions file in style pack does it – it’s around line 2356.

    #216564
    boogieboa
    Participant

    Hi there,

    How do we make site visitors who are not logged-in redirect to a registration page when they click on any topic or post in the forum? It should be a code in functions.php, I think. Any suggestions?

    It would be great to automatically send them back to where they came from once registration is complete. Is this possible?

    Many thanks,
    B

    #216548
    Robin W
    Moderator

    put this in the custom css area of your theme

    #bbpress-forums #bbp-your-profile fieldset fieldset.password {
    		display: none;
    }

    and let me know if it works !

    neon67
    Participant

    Yes, Image Upload for BBPress now. But it can be any other.

    Q. about redirecting a folder from one place to another.
    Perhaps there is a simple solution with code?

    mllapan
    Participant

    Thanks, but I found this is_bbpress function, and solved it.

    add_filter( 'the_content', 'post_ads_1_paragraph' );
     
    function post_ads_1_paragraph( $content ) {
        $ad_code = '<div class="advert" style="display: none;">Reklama1</div>';
     
        if ( is_single() && ! is_admin() && ! is_bbpress() ) {
            return prefix_insert_after_1nd_paragraph( $ad_code, 1, $content );
        }
    	
        return $content;
    }
      
    function prefix_insert_after_1nd_paragraph( $insertion, $paragraph_id, $content ) {
        $closing_p = '</p>';
        $paragraphs = explode( $closing_p, $content );
        foreach ($paragraphs as $index => $paragraph) {
     
            if ( trim( $paragraph ) ) {
                $paragraphs[$index] .= $closing_p;
            }
     
            if ( $paragraph_id == $index + 1 ) {
                $paragraphs[$index] .= $insertion;
            }
        }
         
        return implode( '', $paragraphs );
    }
    Robin W
    Moderator

    This is the bit which displays topics and replies in loop_single_reply

    <?php do_action( 'bbp_theme_before_reply_content' ); ?>
    
    <?php bbp_reply_content(); ?>
    
    <?php do_action( 'bbp_theme_after_reply_content' ); ?>

    you can hook to either of the action hooks here, or a filter in bbp_get_reply content which is called by bbp_reply_content which is in \includes\replies\template.php line 576 and ends with a filter

    return apply_filters( 'bbp_get_reply_content', $content, $reply_id );

    mllapan
    Participant

    I have this function to display advertisement after first paragprah in posts:

    add_filter( 'the_content', 'post_ads_1_paragraph' );
     
    function post_ads_1_paragraph( $content ) {
        $ad_code = '<div class="advert" style="display: none;">Reklama1</div>';
     
        if ( is_single() && ! is_admin() ) {
            return prefix_insert_after_1nd_paragraph( $ad_code, 1, $content );
        }
         
        return $content;
    }
      
    function prefix_insert_after_1nd_paragraph( $insertion, $paragraph_id, $content ) {
        $closing_p = '</p>';
        $paragraphs = explode( $closing_p, $content );
        foreach ($paragraphs as $index => $paragraph) {
     
            if ( trim( $paragraph ) ) {
                $paragraphs[$index] .= $closing_p;
            }
     
            if ( $paragraph_id == $index + 1 ) {
                $paragraphs[$index] .= $insertion;
            }
        }
         
        return implode( '', $paragraphs );
    }

    The problem is that this function is somehow hooked to bbpress forum listing (forum description) to, and shows after forum description.
    So how can I remove it from bbpress so it affects only posts?

    See word “reklama1” after each forum description: https://mllapan.com/forumi/forum/magazin/

    #216445
    bolhachefe
    Participant

    Hi there!

    Check it out my new BBPress forum site with customs design and codes:

    https://bolhabrasil.org/

    Cheers!

    #216429
    xprojectsx
    Participant

    to answer the last question that you gave: in mine
    Replies with no post_parent: 13001
    Replies with no parent in post meta: 0

    Help me, Obi-Wan Kenobi. You're my only hope.

    #216407
    Robin W
    Moderator

    is_bbpress()

    #216406
    haddlyapis
    Participant

    I have been trying to assign some js files only to their respective pages on my site, instead of loading them everywhere and have been successful apart from with my forum area.
    in my functions.php file i have tried the following:

    
    add_action ('wp_print_scripts', 'deregister_forum_scripts');
    
    function deregister_forum_scripts(){
         if ( !is_page('forum') (is_page() && in_array( 19306, get_post_ancestors( get_the_ID() ) ) ) ) {
         wp_deregister_script('forum-js');
    
    }}
    

    whereby i got the id 19306 from my database by doing:
    select ID from wp_posts where post_name = 'forum';
    As the page is http://www.apis.de/forum/
    The issue is, even if I leave out the second part of the “if” statement (i.e. “is_page()….), it doesn’t work.
    I assume this is because my forum is implemented differently to the rest of my site and is not a normal “is_page(….)”.
    Can anyone advise here how to target the forum via PHP?
    Also, i don’t think i should be using “get_post_ancestors” but “get_page_children“. But that is another topic.

    #216390
    akira010203
    Participant

    Hello, my skills are too limited to do that. I’ve simply moved it carefully to be visible for all.

    Can you please remove all our posts previous posts to clean the topic ?

    TO CONCLUDE :

    function rew () {
    
     if ( is_user_logged_in() ) {
    echo '<p><a href="http://your_url/new-posts"><div class="newposts">Show new posts</div></a></p>' ;
    }
    else
    echo '<p><a href="http://your_url/new-posts"><div class="newposts">Show new posts</div></a></p>' ;
    }

    Put this into function.php of your child theme

    .newposts {  
    	 float: left;
    	 background-color:#DD9933;
             padding: 5px 6px;
    	 margin:5px 5px 2em 0;
    			
    }
    
    .newposts a { 
            color:#f2f2f2 !important;
    	border:none;
    	border-radius:0;
    	box-shadow: none;
    	color:#ffffff;
    	font-size:13px;
    }
    

    And put that into your custom style.css. If your button doesnt appear while your loggued or while you’re not, take care of the margin and the padding of the CSS!

    You will have to create a new page “new-posts”. Add [bbp-topic-index] to this page to display your topics in order (most recent ones). If you need a more customizable list, install BBP-Style Pack and go to the Shortcodes section.

    #216379
    akira010203
    Participant

    You can see it now, I put :

    .newposts {  
    	float: left;
    	background-color:#DD9933;
    	padding: 5px 6px;
    	margin:0px 5px 2em 0;
    			
    }
    
    .newposts a { 
            color:#f2f2f2 !important;
    	border:none;
    	border-radius:0;
    	box-shadow: none;
    	color:#ffffff;
    	font-size:13px;
    #216375
    archux
    Participant

    Thank you for input
    I found what caused issue.

    the call for visual composer footer in a shortcode was:

    apply_filters( ‘the_content’, $the_post->post_content );

    The apply of do_shortcode to $the_post->post_content before echo fixed the text format output of shortcodes and footer now works.

    Thank you.

    #216363
    Robin W
    Moderator

    so what is that bit of code trying to do ?

    #216360
    Robin W
    Moderator

    I’ve just taken a look at your site

    the issue is the css

    .newposts {
    	float: left;
    	background-color: #DD9933;
    	padding: 5px 6px;
    	margin: -65px 5px 2em 0;
    }

    if you take out the ‘margin: -65px 5px 2em 0;’ then the code is on screen, otherwise it is offscreen

    #216359
    Robin W
    Moderator

    ok, so

    1. can you post the exact code you are now using
    2. can you tell me where your are putting this code?

    #216358
    akira010203
    Participant

    That’s right! And when I check on the source code in a browser while non loggued, I can clearly see the code with the button.

    #216357
    Robin W
    Moderator

    that’s no problem, and yes it doesn’t look like the issue is in there.

    so the original code works fully with logged in, but not at all with non logged in- yes?

    #216346
    akira010203
    Participant

    It detect the folder “templates” in the theme. (orange color)

    CSS part is green.

    I’ve installed a fresh version of my original theme + created a new child theme.

    If I modify the function.php of the original theme, all works well.
    If I add my content to the function.php of my new child theme, nothing appears…

    I can’t get the new child theme working, like my current one.

    Anyway, strange thing is that I can see the piece of code when I inspect the source with a browser :

    	<div class="bbp-breadcrumb"><p><a href="xxx" class="bbp-breadcrumb-home"><span class="bsp-home-icon"></span></a> <span class="bbp-breadcrumb-sep">&rsaquo;</span> <span class="bbp-breadcrumb-current">Forum</span></p></div>
    	
    	<p><a href="lasts-topics-posts/"><div class="newposts">Show new posts</div></a></p>
    	
    		
    <ul id="forums-list-0" class="bbp-forums">

    It seems to be hidden by something..

    #216341
    Robin W
    Moderator

    ok, just tested and my original code works fine on my test site.

    it could be a theme or plugin issue

    Themes

    As a test switch to a default theme such as twentytwenty, and see if this fixes.

    Plugins

    If that doesn’t work, also deactivate all plugins apart from bbpress and see if this fixes. if it does, re-enable one at a time to see which is causing the error.

    If you cannot do this to your site (say because it is live) then use the ‘troubleshooting’ features of this plugin to let you test without affecting other users

    Health Check & Troubleshooting

    Then come back

    #216333
    akira010203
    Participant

    Thanks Robin but I don’t think this is the easiest way for me to make this button available for users and guests.

    When [bbp-topic-index] is available for all (no restrictions in my board), I just need to put my button available for everyone.

    I’ve tried this :

    add_action ('bbp_template_before_forums_index' , 'rew' ) ;
    
    function rew () {
    if(!is_user_logged_in()) return;
    echo '<p><a href="new-posts/"><div class="newposts">Show new posts</div></a></p>' ;
    }

    and

    function rew () {
    
     if ( is_user_logged_in() ) {
    echo '<p><a href="new-posts/"><div class="newposts">Show new posts</div></a></p>' ;
    }
    else
    echo '<p><a href="new-posts/"><div class="newposts">Show new posts</div></a></p>' ;
    }

    But doesnt works..

    #216318
    akira010203
    Participant

    Hello Robin, once again your advice rocks!

    Here is my result :

    Function.php of my child theme :

    add_action ('bbp_template_before_forums_index' , 'rew' ) ;
    
    function rew () {
    echo '<p><a href="new-posts/"><div class="newposts">Show new posts</div></a></p>' ;
    }

    and my css :

    .newposts {  
    	 float: left;
    	 background-color:#DD9933;
             padding: 5px 6px;
    	 margin:-65px 5px 2em 0;
    			
    }
    
    .newposts a { 
            color:#f2f2f2 !important;
    	border:none;
    	border-radius:0;
    	box-shadow: none;
    	color:#ffffff;
    	font-size:13px;
    }
    
    @media(max-width:580px) {
    .newposts {  
    	float: right;
    	background-color:#DD9933;
    	padding: 5px 6px;
            margin:-15px 0px 2em 0;
    			
    }
    
    .newposts a { 
            color:#f2f2f2 !important;
    	border:none;
    	border-radius:0;
    	box-shadow: none;
    	color:#ffffff;
    	font-size:13px;
    }
    }

    I had to make a custom CSS to get it responssive with mobile phones.

    I still got a little issue which is that my buton dn’t appear when you’re not connect, I need to fix that!

    #216316
    Robin W
    Moderator

    there is a hook in the content-archive-forum.php file you can use

    bbp_template_before_forums_index

    so

    add_action ('bbp_template_before_forums_index' , 'rew' ) ;
    
    function rew () {
    //your code here eg
    echo 'hello' ;
    }
Viewing 25 results - 2,126 through 2,150 (of 32,466 total)
Skip to toolbar