In a buddypress site, on the profile page there is this line of code
<?php do_action( 'bp_after_profile_content' ) ?>
Which generates a 'flag this user link'.
What I would like to know is where this file that generates that is as I am, trying to modify it to remove that link from after the profile and place it somewhere else on the profile.
Thanks!
'bp_after_profile_content' is an action, which means there are (probably) a number of other functions hooked into it that actually create the content. Search the BuddyPress source (grep, which I can't work without, or some equivalent) for "add_action( 'bp_after_profile_content' " and you should be able to find those functions. Once you find the function inserting that link you can probably remove it with remove_action() and then hack things to move that link.
<?php do_action( 'bp_after_profile_content' ) ?> code in your profile.php file.
Remove link in your profile page: Simple just remove the code from your profile.php theme file.
Put profile link to somewhere else: Put this code where you display the profile link.
Thanks
Related
I'm making a WordPress theme by myself since I'm working for the first time in Wordpress I've watched some tutorials about it.
I have page.php header and footer and ofc an index. I insert the content from the pages with this:
<?php echo get_post_field('post_content', $post->ID); ?>
but I tried the get_post in a while loop with same result..
Everything is fine but when I want to use a plugin I can't add to my page... When I insert the shortcode of it it shows only the shortcode string... There are some plugins where I can click a "view" option and it would show a page with my plugin (for example a calendar) but that page is empty...
When I activate an original theme it works instantly... So I'm sure something is missing from my theme something which can load the plugins but I couldn't find solution for it.
Any ideas?
Did you add the <?php wp_head(); ?> function before the head area of the html document is closing? It imports important scripts and styles from wordpress itself (and probably also from the plugins).
See here:
https://developer.wordpress.org/reference/functions/wp_head/
Before closing the body area, the template should also include
<?php wp_footer();?>
See here:
https://developer.wordpress.org/reference/functions/wp_footer/
this is how I'm going with wordpress forum
it is such that even if you do not log into the site you can see what you can create, etc.
Create forum / post to the site just being tucked away so it is only possible to view it if you are login on the page.
Comment content must also be away but just get some text that you can not write content until he has sustained itself on the page.
I purchased this forum
http://themeforest.net/item/forumengine-flat-responsive-wordpress-forum-theme/5999646
WordPress comes with all the functionality needed for this its as simple as wrapping the content you want within an if statement for example
<?php if ( is_user_logged_in() ) {
echo "Member Content";
}else{
echo "Sorry Guest";
?>
id suggest something like above if you are working with template files you could always wrap the while loop with the above
I am developing my own wordpress theme for very first time. I want that when admin login to WordPress, at top admin tool bar must be show on main front end of website.
I tried following things
if (is_user_logged_in())
{
show_admin_bar(true);
}#end if
in functions.php
What I believe that I missed some thing in header.php or index.php, but I am not sure.
The proper way to do this is with a filter in functions.php:
function my_function_admin_bar(){
return is_user_logged_in();
}
add_filter( 'show_admin_bar' , 'my_function_admin_bar');
The admin bar is called as part of the wp_footer() function, so you need to make sure you call that function in your footer section of the template:
<?php
wp_footer();
?>
A discussion of some specific issues that can cause this to break can be found here:
http://wordpress.org/support/topic/admin-bar-not-displaying
And finally, more details on how to use the show_admin_bar() in the functions.php file can be found here:
http://codex.wordpress.org/Plugin_API/Filter_Reference/show_admin_bar
I am making a wordpress site now, and I just inserted an HTML block into my sidebar. I want to to serve 2 functions.
1. If the user isn't signed in, I want it to display a login block. (working)
2. If the user is signed in, I want it to display their avatar. (not working)
I looked up the get_avatar function on the wordpress site, and this is what I found. But it doesn't show anything...
My code:
[logged_out][login][/logged_out]
[logged_in]
<?php
global $current_user;
get_currentuserinfo();
echo get_avatar(ID, 128 );
?>
[/logged_in]
My question, is this because it is an HTML block, and it won't support PHP, or is something wrong with the code?
Define a shortcode in your functions.php
http://codex.wordpress.org/Shortcode_API
Return <img src="avatar_src" /> from shortcode definition
Then you can use that shortcode in your text widget and add this filter to make it working
add_filter('widget_text', 'do_shortcode');
http://codex.wordpress.org/Function_Reference/do_shortcode
in wordpress the single page is controlled by single.php theme file. I want to put another link on the single page like "Preview". I want this link to be handled by preview.php. preview.php will be stored in theme directory! how to handle this?
usually I do these using init action hook! if the variable exists in the query string, I perform the action! but how to register a custom script to handle a custom link!
the single page link is like ?p=x and the link to preview will be ?p=x&action=preview
thanks in advance
You could do it old school style. At the very top of your single.php, put:
<?php
if( isset( $_GET['preview'] ) ) {
require( "preview.php" );
die(); # a horrible death
}
?>