#1 WordPress forum plugin created by gVectors Team

wpForo – WordPress Forum Plugin
  • Home
  • Forum
  • Migrate to wpForo
  • Addons
  • Addons Demo
  • Documentation

Forum

Home | Forum

wpDiscuz - WordPress Comment Plugin
  • Forums
  • Members
  • Recent Posts
Forums
Main Support Forums
How-to and Troubles...
is there a hook to ...
 
Share:
Share
Tweet
Share
Notifications
Clear all

Script is there a hook to add content before comments area?

    Last Post
RSS

newuser20
Posts: 5
 newuser20
Topic starter
October 1, 2021 9:41 am
(@newuser20)
Active Member
Joined: 8 months ago

is there a hook to add content before comments area?

 photo_2021-09-27_18-57-35.jpg
Topic Tags
hook display custom content
8 Replies
Chris
Posts: 1368
 Chris
Admin
October 1, 2021 9:54 am
(@chris)
Support Team
Joined: 10 months ago

Hi @newuser20,

You want a hook under the first post or under all replies?

In case you want to say thank you !)
We'd really appreciate and be thankful if you leave a good review on plugin page. This is the best way to say thank you to this project and support team.

Reply
newuser20
Posts: 5
 newuser20
Topic starter
October 1, 2021 10:14 am
(@newuser20)
Active Member
Joined: 8 months ago

Hello @Chris

thank you for reply

i want a hook under the first post

This post was modified 8 months ago 2 times by newuser20
Reply
4 Replies
Tutrix
 Tutrix
(@tutrix)
Joined: 2 years ago

Honorable Member
Posts: 610
October 1, 2021 1:21 pm
Reply tonewuser20newuser20
Posted by: @newuser20

i want a hook under the first post

You can use the Code Snippets plugin

create a new snippet with this code

add_action( 'wp_head', function () { ?>
<script>
jQuery(document).ready(function(){
jQuery( '<div class="content-after-first-post">Insert here the content to be displayed after the first post</div>' ).insertAfter( "#wpforo #wpforo-wrap .post-wrap.wpfp-first" );
});
</script>
<?php } );

add this to custom css (is only an example)

.content-after-first-post {
background: #f00;
color: #fff !important;
padding: 10px !important;
margin: 10px auto !important;
font-size: 18px !important;
}

Dashboard > Forums > Settings > Style (custom css)

visit my wpForo > Tutrix.de with lots of customization & modification, inclusive chat

Reply
Robert liked
Chris
 Chris
Admin
(@chris)
Joined: 10 months ago

Support Team
Posts: 1368
October 1, 2021 1:35 pm
Reply tonewuser20newuser20

@newuser20,

Insert the bellow code in \wp-content\themes\ActiveTheme\functions.php file

add_action('wpforo_loop_hook', function($key){
    if( $key === 0 ){
        echo 'Your text Here';
    }
});

 

In case you want to say thank you !)
We'd really appreciate and be thankful if you leave a good review on plugin page. This is the best way to say thank you to this project and support team.

Reply
newuser20
 newuser20
(@newuser20)
Joined: 8 months ago

Active Member
Posts: 5
October 1, 2021 2:03 pm
Reply toChrisChris
newuser20

@chris 

it working but the content appear in every page 

is there a way to show the content in post pages only?

This post was modified 8 months ago 2 times by newuser20
Reply
Chris
 Chris
Admin
(@chris)
Joined: 10 months ago

Support Team
Posts: 1368
October 2, 2021 11:01 am
Reply tonewuser20newuser20
Chris
newuser20

@newuser20,

Remove the Hook I gave you, Read this doc about theme customization:

https://wpforo.com/docs/root/forum-themes/theme-customization/

You need to customize wpForo theme to get the result you want.

In case you want to say thank you !)
We'd really appreciate and be thankful if you leave a good review on plugin page. This is the best way to say thank you to this project and support team.

Reply
newuser20
Posts: 5
 newuser20
Topic starter
October 2, 2021 11:03 am
(@newuser20)
Active Member
Joined: 8 months ago

how to detect if current page is a post page and how to get all post information?

Reply
1 Reply
Robert
 Robert
Admin
(@robert)
Joined: 6 years ago

Support Team
Posts: 8967
Robert - Twitter
October 3, 2021 1:46 pm
Reply tonewuser20newuser20

@newuser20,

Here is the code provided by @chris and modified to work only on the posts page:

add_action('wpforo_loop_hook', function($key){
if( function_exists('WPF') && WPF()->current_object['template'] === 'post' && $key === 0 ){
echo 'Your text Here';
}
});

In case you want to say thank you !)
We'd really appreciate and be thankful if you leave a good review on plugin page. This is the best way to say thank you to this project and support team.

Reply
  All forum topics
  Previous Topic
Next Topic  
Related Topics
  • Quote, Reply, Like Hooks for custom push notification
    1 year ago
  • API] Problem with avatar link
    1 year ago
  • Which Files Contain Log In & Register Modal Code
    2 years ago
  • Is there a way to block links to competitor sites?
    2 years ago
  • Add the number of categories to the statistics in the footer
    2 years ago
Topic Tags:  hook (10), display custom content (1),

Forum Search

Join Us!

Download wpForo plugin
on WordPress.org

wpForo Addons

wpforo-private-messages wpforo-advanced-attachments-128x128 wpforo-embeds-128x128 wpForo User Custom Fields addon wpForo – Blog Cross Posting addon wpForo Ads Manager wpForo – WooCommerce Memberships Integration wpForo Emoticons wpForo – Tenor GIFs Integration
View all Addons »

Recent Topics

  • Costume text and image on every forum

    By Vijiki, 7 hours ago

  • Forum topics and pages not indexing

    By Vijiki, 15 hours ago

  • Can't send confirmation email from topics when suscribe for new topic

    By gilbau, 19 hours ago

  • Can't add shortcodes to wpForo

    By avorai, 19 hours ago

  • New Feature H1 title for tags

    By annushka, 1 day ago

  • File in antisapm protection not deleted

    By pesimist57, 2 days ago

Topic Tags

  • translation49
  • css49
  • plugin conflict48
  • seo45
  • new features44
  • buddypress42
  • ultimate member40
  • avatar40
  • forum40
  • moderation38
  • login38
  • registration36
  • threaded layout35
  • cache33
  • editor32
  • menu32
  • shortcode31
  • spam29
  • phrases28
  • forum accesses28
View all tags (2162)

Recent Posts

  • RE: Show Likers with their avatar

    No, I don't use any such function. The reason I asked i...

    By fawp, 6 hours ago

  • Costume text and image on every forum

    Is there a way I can add text or image on forum pages ...

    By Vijiki, 7 hours ago

  • RE: Can't send confirmation email from topics when suscribe for new topic

    @gilbau, wpForo uses WordPress wp_mail() function. wp...

    By Robert, 13 hours ago

  • RE: Forum topics and pages not indexing

    So all is ok from wpForo site. I have nothing to add he...

    By Robert, 13 hours ago

  • RE: Can't add shortcodes to wpForo

    @avorai, Again, I don't see any relation of this issu...

    By Robert, 14 hours ago

  • RE: Can users be in multiple forums?

    @monimair, wpForo has secondary usergroups function so...

    By Chris, 16 hours ago

  • RE: H1 title for tags

    Hi @annushka, Your suggestion has been added to our t...

    By Chris, 16 hours ago

Share:
Share
Tweet
Share
  Forum Statistics
20 Forums
9,755 Topics
49.4 K Posts
6 Online
43.5 K Members

Latest Post: Show Likers with their avatar Our newest member: [FILM] Ваша Честь 9 Серия Recent Posts Unread Posts Tags

Forum Icons: Forum contains no unread posts Forum contains unread posts

Topic Icons: Not Replied Replied Active Hot Sticky Unapproved Solved Private Closed

Powered by wpForo | Copyright © 2016-2022 gVectors Team
Copyright Registration Service - Click here for more information or to register work
wpForo is Registered with the IP Rights Office
Copyright Registration Service

Ref: 4477265538
  • Home
  • Forum
  • Migrate to wpForo
  • Addons
  • Addons Demo
  • Documentation