Wordpress Theme Overriding Plugin - wordpress

I installed a plugin for a dropdown menu (Max Mega Menus) but my wordpress theme (Spacing) is overriding it. I followed the instructions on the MMM website on removing residual styling so that the plugin would work but when I deleted the codes as instructed (I think I picked the right one) then the menu disappeared altogether. Here are the instructions I was following: https://www.maxmegamenu.com/documentation/faqs/removing-residual-styling/
Here is the current coding. I tried deleting every combination of things besides the wp_nav_menu part, as instructed.
<div id="header">
<div id="wrapper">
<div class="container clearfix">
<div id="navigation">
<?php wp_nav_menu(array('menu' => 'custom_menu')); ?>
<?php if($of_option['st_responsive']) responsive_select_nav() ?>
</div>
</div>
</div>

Please go to Mega Menu > General Settings > Menu Locations. You'll see a list of menu locations that your theme has registered. Expand the one for the top menu and copy the PHP include code. Then replace the call to wp_nav_menu in your header.php file with it.
In short, your wp_nav_menu call is missing the required 'theme_location' argument.

Related

Creating Drop-Down Menu For Custom Wordpress Theme

I'm trying to build a Wordpress theme from scratch. The drop down menu isn't appearing, although I added the list pages tag. Here is the code I'm using for the wp_nav_menu function.
<?php wp_head(); ?>
</head>
<body>
<div class="nav">
<div class="container">
<ul class="pull-left">
<li class="cursive">Mu Alpha Theta</li>
</ul>
<?php wp_nav_menu( array('menu' => 'Menu' )); ?>
</div>
</div>
The pages appear on the site's menu; however, they aren't merging into a drop-down. I'm wondering if it has something to do with the CSS. As in, do I have to create a structure for how it would look? Or, I'm thinking that I'm misusing th wordpress function.
Thank you for reading my questions. I would love to hear any advice.
If it's placing, but not as you want (in a drop down) it would seem to be a css issue. There are many arguments you can parse to the function outlined here in the codex. From there it's just using the id's/classes and css to get the display you're looking for.
Also, from that codex page:
Note: As of 3.5, if there are no menu items, no HTML markup will be
output.
So ensure there is some items in your menu as well, even for testing.
Depending on how fancy you want to be, you may need a custom Walker. Caveat emptor: they are not for the faint of heart.

Buddypress Plugin Theme error

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.

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.

WordPress page.php competing with index.php

Background: I'm messing around with theme development for WordPress. I'm a noob. I've completed multiple tutorials on how to develop themes. The theme that I'm currently working on has a problem with page competition I think. I'm building it on MAMP (if that's important). There is not much to this new theme right now. I just started and made all the template files I thought I'd need. Everything except "index.php" and "style.css" is blank. There is nothing in the functions file either. All the information for the header and footer and menu are currently just in "index.php".
Problem: When I include the file "page.php" in the theme folder, nothing loads on the page. And I don't mean just visually. None of the elements from the templates appear at all on the page. I have "index.php" in the theme folder as well. When "page.php" is removed from the folder, the theme loads everything just as it should. It is my understanding, according to the WordPress Hierarchy that the index is called before the page template. I do plan on using pages. So it seems to me that "page.php" is competing with index.php and breaking the template.
The Question: Is "page.php" a competitor to "index.php" and how can I fix it so that it is not breaking my theme? Why might it do this on my theme and not on others?
What I've Tried:
Copied the contents of "index.php" into "page.php". The theme then loaded as expected but I anticipate this causing problems down the line.
Leaving page template blank with index template full of code produces nothing. Leaving index blank with page full of code results in the theme loading.
Copied "page.php" from another theme. Theme broke. Copied index from another theme. Still broken.
Changed CSS just to make sure I didn't have any CSS that was causing these elements not to appear. Again though, they don't even show up when I use firebug or view source.
What I've Read: I've done my homework to try an resolve the issue without having to ask another question on stack but I can't seem to find anyone else with this same problem (which only makes me think it's probably something obvious that I'm doing wrong but since I'm a noob I missed it or something). I've read through all of these in their entirety:
A Similar Question on Stack
A WordPress Forum About Page Hierarchy
I've Double Checked the WordPress Codex
I've done just about every Google search you can think of... to
no avail.
Any help on this matter is greatly appreciated. Latly here is the contents of index.php:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>WordPress Training Wheels</title>
<link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=Dancing+Script:400,700' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="container" class="container_16">
<div id="header" class="grid_16"><!-- Header Begins Here -->
<h1><?php bloginfo('name'); ?></h1>
<h2><?php bloginfo('description'); ?></h2>
<?php
wp_nav_menu(
array(
'theme_location' => 'top_header',
'container' => 'div',
'container_id' => 'top-menu',
'menu_class' => 'top-menu-list',
'fallback_cb' => 'false'
));
?>
</div>
<?php
wp_nav_menu(
array(
'theme_location' => 'bottom_header',
'container' => 'div',
'container_id' => 'menu',
'menu_class' => 'bottom-menu-list'
));
?>
<div id="content">
<div class="sidebar left grid_3"><!-- Left Sidebar Begins Here -->
<h4>Sidebar Header</h4>
<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Left Sidebar') ) : ?>
<h3 class="widget-title">Categories</h3>
<ul>
<?php wp_list_categories(); ?>
</ul>
<h3 class="widget-title">Archives</h3>
<ul>
<?php wp_get_archives(array('type' => 'monthly')); ?>
</ul>
<?php endif; ?>
</div>
<div id="middle-column" class="grid_6"><!-- Main Content Begins Here -->
<h3>Training Wheels Lesson 1</h3>
<p><img src="<?php bloginfo('template_directory'); ?>/images/training-wheels.jpg" width="426" height="142" alt="Training Wheels" /></p>
</div>
<div class="sidebar right grid_3"><!-- Right Sidebar Begins Here -->
<h4>Sidebar Header</h4>
<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Right Sidebar') ) : ?>
<h4>No Widgets added</h4>
<p>Please login and add some widgets to this sidebar</p>
<?php endif; ?>
</div>
<div style="clear:both;"></div>
</div><!-- Content Ends Here -->
<div id="footer"><!-- Footer Content Begins Here -->
<p>© Wordpress Training Wheels, by wpbedouine</p>
</div>
</div>
</body>
</html>
After a lot of searching I believe I've found the solution. "home.php" was not ever being used by the theme because I didn't have an important line in the comments at the top. I added:
<?php
/*
Template Name: Front Page
*/
?>
to the top of "home.php" and then went in to the wp-admin and clicked on pages>all pages>home. I then found a drop down list item called "Template" on the right side of the page editor. I changed it from 'default template' to 'Front Page'.
I guess the way I was reading the hierarchy made me assume that WordPress would automatically use "home.php" or "front-page.php" as the template for the homepage. Apparently this is an incorrect assumption because without that line in the comments and telling it what template to use, WordPress will just use page.php as the template.
At least, that's how it seems to me. Anyone who would like to improve on this answer or make corrections please do.
Just an idea, but could your home page be set to a page, instead of the blog? As in Settings >Reading. http://codex.wordpress.org/Creating_a_Static_Front_Page
Otherwise, I don't see why your home page would be using page.php instead of index.php.
Below might help.
If you have both Home and Blog page set, then wordpress used index.php for the blog and uses front-page.php for the home page you have set. Incase, only home page is set and their is no front-page.php created, it uses only index.php

Wordpress, short codes wont work in custom theme I made

I have started to learn how to make custom themes for wordpress and have problems when installing plugins that have shortcodes. I try to add a shortcode ( usually a form plugin, i have tried two different ones and also an ecwid shopping cart yet no shortcodes have worked, yes the plugins were activated) by creating a page and using the visual/html editor. When i check the page it does not show anything. here is my single.php..
<?php get_header(); ?>
<body>
<div id="maintopwrapper">
<div class="container" id="topwrapper">
<div class="row">
<div class="span8">
<?php while (have_posts()) : the_post(); ?>
<!-- Content Here -->
<div class="row"><div class="span8 greygrad round">
<div class="padding"><div class="content" style="margin-top:25px;"><?php the_content(); ?></div></div></div></div>
<div class="row margintop"><div class="span8 greygrad round">
<div class="padding">
<?php comments_template() ?>
</div></div></div>
<?php endwhile;?>
</div>
<?php get_sidebar(); ?>
</div>
</div>
</div> <!-- end of maintop wrapper-->
<?php get_footer(); ?>
It should show since the_content() is there right? Let me know if you need anything else for me to share. Plugins I tried a gravityforms, ecwid shopping cart, and quforms..all of which the shortcodes do not work. The only way I got one of them to work is by creating a custom page theme and adding hardcoded php to call the function but I rather have shortcodes working so the theme is usuable by people who dont code.
For live example: http://modernlogic.co/wp
the "contact" page in menu is actually hardcoded in the custom theme which is not using the shortcodes like I want in the "sample page" in menu
Thanks in advance
I am a idiot... I realized that I had no page.php and so when I tried adding the shortcode to a page it referred to the index.php instead of page.php(since there was none) and so it only showed the excerpt and not the content. I figured this out because I tried adding the shortcode to a post and so when it went to single.php, the shortcode worked since it has content and not just excerpt. oh well I guess trial and error.. Thanks for trying to help me anyway

Resources