Buddypress Plugin Theme error - wordpress

This is with respect to a buddypress addon (plugin) whose theming I am unable to do. I searched many sites but unable to get a concrete solution. In the plugins page, Header is getting disturbed if its a buddypress theme but is working fine in default wordprress themes.
I am using this code at present at the top of the template page
<?php get_header('buddypress'); ?>
<div id="buddypress">
<div id="profile">
<div class="row">
Than the following stuff like
<?php do_action( 'bp_before_member_home_content' ); ?>
<div id="item-header" role="complementary">
<?php bp_get_template_part ( 'members/single/member-header' ) ?>
</div><!--#item-header-->
I feel this is not the right way to do. I want to know if the plugin has to copy the buddypress template header without disturbing footer or sidebar how it can be done. i.e my plugin should show only the plugin content and should not disturb any part of the buddypress template.

you have to edit your buddy press header with your html structure.
and keep buddy-press functionality as it is.

Related

How can I call a plugin in wordpress?

I'm trying to create my first theme on wordpress by zero.
I add Disqus plugin to manage the comments for the post.
which is the standard function to call the plugin in post page?
my current post page looks like this:
<?php
get_header('post');
//get_template_part( 'single-post-content' );
?>
<div id="slide1">
<div class="article_content">
<h2 style="margin-bottom: 50px;"><?php the_title(); ?></h2>
<div class="content">
<?php the_post(); the_content(); ?>
</div>
</div>
</div>
<?php get_template_part('post_footer'); ?>
I'd like to display the comments box under each post
how would you do it starting by zero?
You don't need to call the plugin's function.
To display the comments, you should call the comments_template function in your template and add a comments.php in your theme folder.
In the comments.php, you should call comment_form to display the default WordPress form.
And after you activate the Disqus plugin, the plugin will replace the default WP comment form by some actions and filters.
You can refer to the default WordPress theme to know how to display the comments.
The code is in twentysixteen/single.php and twentysixteen/comments.php
update
If the plugin(Disqus WordPress) doesn't work well, you could manually install Discuz on your theme. Please refer to https://help.disqus.com/customer/en/portal/articles/1183281-manually-install-disqus-on-wordpress

How do I create different editable sections within a WordPress page?

I have been building my first theme on WordPress and have run into problem while adding content into different sections.
My HTML is somewhat like this,
<div id="maintext">
<-- Text -->
</div>
<div id="products">
<-- Text and Images -->
</div>
<div id="about_company">
<-- Text boxes -->
</div>
How do I make sure the content added via the WordPress editor falls under the respective divs ? For the "maintext" div I'll load the content from the page itself but how do I add content to the other 2 divs dynamically ?
I searched on a couple of forums and many suggested to add content using widgets, is there any way it can be done without using widgets ?
Any help will be gladly appreciated.
Unfortunately adding multiple editable fields in a single page is not particularly easy using WordPress by itself.
Many WP devs I know (myself included) rely on the Advanced Custom Fields Plugin for additional content fields.
The steps to make this happen:
1) Install the ACF the plug.
2) In the settings area for ACF create some new fields.
3) Assign the new fields to appear for a specific page or set of pages.
4) Update your page-template for the given page(s) so that the new fields are displayed.
For instance you might create a set of standard wysiwyg fields and then assign them to the 'overview' page. Let's call these fields: main_text, products_info and about_company. Once the fields have been created and assigned to a page, when you edit that page the additional fields will be available to edit.
For these new fields to be seen by visitors, they must be added to the page-template you use for your overview page. The code could be something like this:
<div id="maintext">
<!-- Text -->
<?php if(get_field('main_text')){ //if the field is not empty
echo '<p>' . get_field('main_text') . '</p>'; //display it
} ?>
</div>
<div id="products">
<!-- Text and Images -->
<?php if(get_field('products_info')){ //if the field is not empty
echo '<p>' . get_field('products_info') . '</p>'; //display it
} ?>
</div>
<div id="about_company">
<!-- Text boxes -->
<?php if(get_field('about_company')){ //if the field is not empty
echo '<p>' . get_field('about_company') . '</p>'; //display it
} ?>
</div>
There are lots of good examples here. If you are feeling really ambitious, rather than install the plugin you could even include ACF directly in your theme.
You've got three options I believe:
Create a widget area where you can then display the content in a text widget: http://codex.wordpress.org/Function_Reference/register_sidebar
Create a template where you then get the content of a different page: http://codex.wordpress.org/Page_Templates#File_Folders
Create a new meta box for all your pages: http://codex.wordpress.org/Function_Reference/add_meta_box
I believe that the thing you are looking for is option 2. The others are more full-site oriented, if you want the extra content to show up on every single page.
If you are writing the theme, maybe you would like to consider using a WordPress Framework so you don't have to start from scratch.
If that is not the case, think of the end user. How will they add sections to pages and posts? Will they have to move across places within the WordPress UI, or would they rather user short codes?
My recommendation is to build a plugin that render the section within the document content. Or widget content if that is the case.
I wrote a little piece of code to illustrate how you can accomplish such a thing, and also because I kind of need it right now :D. You can find it on github here https://github.com/lionpage/Front-Office-Document-Sections
Hope this helps
<div id="maintext">
<?php the_content(); ?>
</div>
<div id="products">
<?php // echo wp function to get product data; ?>
</div>
<div id="about_company">
<?php // echo wp function to get about companydata; ?>
</div>
I've run into this issue several times now, and while the question is 3 years old, I think it's still rather current. I've succesfully used the Multiple Content Blocks plugin sometimes now:
https://ltz.wordpress.org/plugins/multiple-content-blocks/
After installing the plugin, you can just include the_block in your template:
<div id="maintext">
<?php the_content(); ?>
</div>
<div id="products">
<?php the_block('products') ?>
</div>
<div id="about_company">
<?php the_block('company') ?>
</div>
hi im currently developing a theme with that set up.
there are two ways to achieve this:
widgetized and fixed admin panel (customizer options)
i am using the two in my themes
if widgets
create a .php file that includes the widgets sections
create a widget for that section
if fixed in admin panel
you have to include the .php section in your functions.php
edit * advantage of widgetized is you can arrange them just like in a regular sidebar
Was struggling with this, and did not want to use a plugin. The only WordPress native option I found was to use Custom Fields. This works, but only for text, and is rather cumbersome.
The other non-plugin option is to simply use HTML in the WordPress editor, but this is of course far from ideal either.
Finally I gave up, and opted for the Advanced Custom Fields plugin as well.

how do i add different custom right sidebars with different widths and content on different pages in wordpress?

i everyone i have afew pages in wordpress that i need different custom right sidebars on with different css styles. for example i would like my homepage right sidebar to be a set width say 100px and displaying specific content and id like to have my special offers page with a right sidebar thats a different width say 230px displaying different content like widgets etc...
to my understanding this should be able to be achieved by creating custom sidebars by registering them with a wordpress function and then creating a custom sidebar template php file with a different css class for the sidebar. and then calling the new custom sidebar template file inside of a custom page template file being applied to a target page in wordpress so that the page loads the custom sidebar template instead of the normal sidebar template with a new css class that can be modified to achieve different sidebar styles for different pages. so i created the following custom sidebar template and called it customrightsidebar.php
<div id="sidebar3"><div class="sidebar3"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('customright-sidebar') ) : ?><div class="customright-sidebar"><h4>Recent Posts</h4><ul><?php wp_get_archives('type=postbypost&limit=5'); ?> </ul></div><?php endif; ?></div> <br style="clear:both"></div>
i then registered a new custom sidebar using this function
register_sidebar(array('name'=>'customright-sidebar','before_widget' => '<div class="customright-sidebar">','after_widget' => '</div>','before_title' => '<h4>','after_title' => '</h4>',));
and here is the custom page template that is calling the custom sidebar template
<?php get_header(); ?><div id="breadcrumb"><?php breadcrumbs(); ?></div>
<?php include(TEMPLATEPATH."/customrightsidebar.php");?>
<div id="kontenutama"> <div class="postingan2"><?php if (have_posts()) : while (have_posts()) : the_post(); ?><h2><?php the_title(); ?></h2><?php the_content(); ?><?php endwhile; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p><?php endif; ?><br style="clear:both;"></div></div>
<br style="clear:both"><div style="clear:both"></div><?php get_footer()?>
i successfully have a custom right sidebar that appears in my wordpress admin panel and i can apply widgets to it in the widgets section of my admin panel i can also see it appear in the custom sidebar dropdown selection menu in my wordpress pages where you would specify your new custom sidebars to overwrite the old ones. you can see a screenshot of the sidebar selection boxes in my theme by visiting this url
http://test.smartphonesource.org/sidebars.png
and normally by selecting it it would overwrite the default sidebars on the page
i have been able to get the custom sidebar template to load with the custom class on the page and ive been able to edit the css but the actual custom sidebar itself with its widgets isnt appearing or overwriting anything even though ive selected it to overwrite the right sidebar of the current page in the custom sidebars selection box
im not sure where to go from here or if there is a different way to do this i think somewhere the customsidebar isnt overwriting the default right sidebar when its been selected in the custom sidebar selection box on my pages im new to wordpress and php. ive been able to use the customright-sidebar on my videos page for testing and it successfully overwrote the right sidebar and worked but it was running this default right sidebar template
<div id="sidebar2"><div class="sidebar2"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar Right') ) : ?><div class="left-sidebar"><h4>Recent Posts</h4><ul><?php wp_get_archives('type=postbypost&limit=5'); ?> </ul></div><?php endif; ?></div> <br style="clear:both"></div>
anyhelp would be greatly appreciated figuring this out =) you can see the homepage of the site here that im using to learn wordpress and from there you can navigate to the videos and special offers page that im tearing apart to get a better idea of what im trying to do with the sidebars
http://test.smartphonesource.org
First of all, your website looks really awesome:) And to fix this did you make sure that your page is only grabbing the new sidebar code only?
i managed to fix the page issue im not sure what was wrong but it suddenly started working with the same code i know i cleared my cache so maybe that was affecting it or preventing the new changes from appearing sometimes if i dont clear the cache after i upload new images they wont display for me

creating wordpress template

I need to create a fresh wordpress template using adobe dreamweaver . I want the template with image slider , stylish menus and commenting options. please guide me from basic to end.
Maybe you'll find this tutorial helpful:
http://www.adobe.com/devnet/dreamweaver/articles/dw-wordpress-multiscreentheme.html
as well as this:
http://www.adobe.com/devnet/dreamweaver/articles/dw_wordpress_pt1.html
Wordpress Template starts with
<?php /* Template Name: Stylish Template */ ?>
<?php get_header(); ?> // go to header.php add required js file for slider & menu through wordpress function() <?php wp_nav_menu($args); //check wordpress documentation for $args.
<div id="slider">
--images will go here
</div>
<div id="content">--Content Goes here---These will be posts from any category or latest posts, look wordpress documentation for <?php comment_template() to add comments if they are disabled.?></div>

Wordpress : Multiple Columns on Homepage

I am trying to create a Wordpress site. The design is Here
I have created most of the outline of the site, barring the 3 regions "Follow Us", "Self Employment" & "Into Work Consortium".
The client has told me he would like to make those 3 regions editable.
My template contains an Index file, Header & Footer File as well as the obvious CSS files.
I am using the "Multi Edit Plugin" Multi Edit Plugin but that guide, does it so that you create a CustomPage. I guess I could do that but what I want is my index.php file to be added to the admin side of the site and then point the template there or similar.
As it's getting a little frustrating working with multiple WP plugins that just don't seem to do the job correctly.
There are many ways to go about this: one being what was mentioned by Pekka and the other using Custom Page templates.
The above mentioned methods are, in theory, quite similar with subtle differences in terms of execution and inclusion.
Perhaps to better answer your question, I will provide a very brief sample outline below on Custom Post Templates. You may probably need to do a little more digging at Wordpress' Codex if you choose to further enhance anything else:
Custom Post Template Method
Referring to the wireframe provided in your image link, I propose that you use category filters to filter the associated posts to the right columns. So first up, you will need to create 4 categories for the method that I'm suggesting, namely: WELCOME, FOLLOW, SELF-EMPLOYMENT and CONSORTIUM.
After doing so, your index.php should look something like this:
INDEX.PHP
<?php get_header();?>
<!--container-->
<div id="container">
<?php query_posts('category_name=welcome&showposts=1'); ?>
<?php while (have_posts()) : the_post(); ?>
<!--top-content-->
<div class="top-content">
<h2><?php the_title();?></h2>
<p><?php the_content();?></p>
</div>
<!--top-content-->
<?php endwhile;?>
<!--bottom-content-->
<div class="bottom-content">
<!--follow-->
<div class="follow">
<?php include(TEMPLATEPATH . '/follow.php');?>
</div>
<!--follow-->
<!--self-employment-->
<div class="self-employment">
<?php include(TEMPLATEPATH . '/self-employment.php');?>
</div>
<!--self-employment-->
<!--consortium-->
<div class="consortium">
<?php include(TEMPLATEPATH . '/consortium.php');?>
</div>
<!--consortium-->
</div>
<!--bottom-content-->
</div>
<!--container-->
<?php get_footer();?>
What is happening here is that I'm doing a post query for posts tagged to the category "WELCOME" and filter the posts into the top-content DIV. Note that my loop starts right before of the top-content DIV and ends immediately after it. This will means that the loop will only affect that particular DIV. I have also set the post limit to "1", thereby restricting the display of posts to just the latest post.
Following on from there, you will notice that in the bottom-content DIV, I have included 3 different files for each column. These 3 files will be your custom post templates that you will need to create and have a post query to filter in the right post. An example of the custom post template will look something like this below:
FOLLOW.PHP
<?php query_posts('category_name=follow&showposts=1'); ?>
<?php while (have_posts()) : the_post(); ?>
<h2><?php the_title();?></h2>
<?php the_post_thumbnail('bottom-content-thumb');?> <!--you will have to enable featured image thumbs in your functions.php file before you can do this-->
<span class="read-more">Continue Reading</span> <!--there are other ways to do the read more link, but I'm just giving an example now so yeah-->
<?php endwhile;?>
The rest of the custom post templates for the bottom 3 columns should look something like the above. If there is any variation of style and all, you will probably have to shift things around and play around with the CSS.
I want to stress that this is not the one and only way to do what you hope to achieve, but rather, that it is one of the many. What I've suggested is only an example that hopes to provide some insights on how you can utilize Custom Post templates for developing Wordpress based sites.
My advice at the end of the day is to delve deeper into Codex and find out more about Custom Post/Page templates because eventually, they will come in very handy if you choose to make custom Wordpress templates.
Hope my post had made things a little clearer for you =)

Resources