Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Wordpress Theme development Questions

Featured Replies

Hi All,

 

I am doing my first Wordpress theme and am running into a lot of little things that I am nt sure how to do so i thought I would put them all into this post:

 

1. How do I create a page and not have it showing in the main navigation?

 

2. How can I make it that the Wordpress WYSIWYG is not adding HTML SPAN tags to the content?

 

3. What is the best way to make a link point to a specific page in wordpress tags? Instead of direct link?

 

Thanks :)

If you want to exclude certain pages I'm sure there is an exclude argument for the wp_list_pages.

 

I'm sure this would only exclude certain pages though and every time you created a new page you'd have to alter the code so probably not the best way.

 

Maybe there is a plugin?

  • Author

1. How do I create a page and not have it showing in the main navigation? Found this out:

 

Added the following to the Nav tags: 'exclude'=> '95,104',

 


<?php wp_nav_menu( array( 'exclude'=> '95,104', 'sort_column'  => 'menu_order', 'menu_class' => 'nav', 'theme_location' =>  'primary-menu' ) ); ?>

 

I have another Question:

 

4. What code do I add to certain areas of my theme files in order to get plugins / widgets to display there?

 

Thanks :)

  • Author

If you want to exclude certain pages I'm sure there is an exclude argument for the wp_list_pages.

 

I'm sure this would only exclude certain pages though and every time you created a new page you'd have to alter the code so probably not the best way.

 

Maybe there is a plugin?

 

Thanks for the tip :)

Hello! This step-by-step tutorial (themetation dot com/2008/07/14/how-to-create-wordpress-themes-from-scratch-part-1/) really helped when I made my first from-scratch theme. It lists and defines all Wordpress required pages and even discusses image slicing for your page layout. It's a few pages long but just keep at it. You'll have a working theme if you'll just follow the steps. Good luck!

Edited by commonzen

Hi All,

 

I am doing my first Wordpress theme and am running into a lot of little things that I am nt sure how to do so i thought I would put them all into this post:

 

1. How do I create a page and not have it showing in the main navigation?

 

2. How can I make it that the Wordpress WYSIWYG is not adding HTML SPAN tags to the content?

 

3. What is the best way to make a link point to a specific page in wordpress tags? Instead of direct link?

 

Thanks :)

 

1. Define your navigation as a WP3 custom menu. That makes adding pages opt-in.

 

2. Where's it adding spans?

 

3. How d'you mean? You can add internal links in the WYSIWYG dialogue as of WP3, not sure if it's persistent through a change of permalink structure though.

 

4. functions.php:

 

function yourtheme_widgets_init() {
 register_sidebar(
   array(
     'name' => __('Primary Widget Area', 'yourtheme'),
     'id' => 'primary-widget-area',
     'description' => __('The primary widget area', 'yourtheme'),
     'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
     'after_widget' => '</li>',
     'before_title' => '<h3 class="widget-title">',
     'after_title' => '</h3>',
     )
 );
// Repeat the above for each widget area 
}
add_action('widgets_init', 'yourtheme_widgets_init');

 

In your template:

 

<ul class="xoxo">
<?php if(!dynamic_sidebar('primary-widget-area')) : ?>

<!-- Default content for when no widgets are found in the sidebar goes here -->

<?php endif; ?>
</ul>

Edited by Renaissance-Design

  • Author

1. Define your navigation as a WP3 custom menu. That makes adding pages opt-in.

 

2. Where's it adding spans?

 

3. How d'you mean? You can add internal links in the WYSIWYG dialogue as of WP3, not sure if it's persistent through a change of permalink structure though.

 

4. functions.php:

 

function yourtheme_widgets_init() {
 register_sidebar(
   array(
     'name' => __('Primary Widget Area', 'yourtheme'),
     'id' => 'primary-widget-area',
     'description' => __('The primary widget area', 'yourtheme'),
     'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
     'after_widget' => '</li>',
     'before_title' => '<h3 class="widget-title">',
     'after_title' => '</h3>',
     )
 );
// Repeat the above for each widget area 
}
add_action('widgets_init', 'yourtheme_widgets_init');

 

In your template:

 

<ul class="xoxo">
<?php if(!dynamic_sidebar('primary-widget-area')) : ?>

<!-- Default content for when no widgets are found in the sidebar goes here -->

<?php endif; ?>
</ul>

 

Thanks dude, helps a lot :)

  • Author

Hey Guys,

 

I'm still not sure how I can now show the 2 pages that I excluded elsewhere.

 

Any ideas how I can use wp_list to display only 2 pages ?

 

Thanks

 

:)

  • Author

Im also having issues with my test wordpress now:

 

I get the following error when trying to access the /wp-admin/ (backend)

 

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/domain.com/wp-content/themes/New 3.0 Theme/functions.php:25) in /var/www/vhosts/domain.com/wp-includes/pluggable.php on line 897

 

What does this mean??

 

Hope someone can help me. Thanks :)

  • Author

Im also having issues with my test wordpress now:

 

I get the following error when trying to access the /wp-admin/ (backend)

 

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/domain.com/wp-content/themes/New 3.0 Theme/functions.php:25) in /var/www/vhosts/domain.com/wp-includes/pluggable.php on line 897

 

What does this mean??

 

Hope someone can help me. Thanks :)

 

Anyone Had this before?

  • Author

Double check your themes functions file for blank spaces at the start of the file. Also check in wp-config too.

if there are blank lines/spaces then remove them.

 

Thanks dude, will try this tonight as Its driving me crazy. I know it was after I edited something on the theme. Im also not able to see the header image anymore which is wierd. I need to complete the theme by the end of the week also :(

Anyone Had this before?

 

Hey mate, yeah I've had the exact same message previously, drove me crazy. When you last made an edit to the code, you may of accidentally deleted or changed a line of code.

 

Did you make a backup before changing the code? I strongly advise this with Wordpress because I've seen that a couple of times but was able to revert straight back with the backed up code.

 

Let us know how you get on. I started with Wordpress a couple of months ago but I know it quite well now.

Thanks dude, will try this tonight as Its driving me crazy. I know it was after I edited something on the theme. Im also not able to see the header image anymore which is wierd. I need to complete the theme by the end of the week also :(

 

Try adding ob_start(); at the start of your functions.php and that should temporarily stop the error and get you back into the Control Panel.

 

Don't suppose you remember what the last file you edited was before the error appeared?

  • Author

Try adding ob_start(); at the start of your functions.php and that should temporarily stop the error and get you back into the Control Panel.

 

Don't suppose you remember what the last file you edited was before the error appeared?

 

I have no idea what file I last made edits too :( I usually have a few of the pages open in notepad ++ and just edit and preview at the same time :)

 

I will try adding that at the start and comparing the files to another theme. I dont make backup copies of my code :( so I have no way of reverting it. Damn.

All it was for me was blank spaces at the beginning (or possibly end) of a couple of files.

Start with the functions.php file and delete anything before the opening <? and anything after the closing ?>

Then try the same with the wp-config.php, if no luck continue with the rest of the theme files. Shouldn't take you more than 5 minuets.

  • Author

Hey all,

 

I have checked the functions file etc and still getting the issue of the header image not displaying now :(

 

This is the code I am using in the header file:

 


<p><a href="<?php echo get_option('home'); ?>"><img src="<?php bloginfo('template_directory'); ?>/images/header2.jpg" alt="<?php bloginfo('name'); ?>" name="logo" width="960" height="272" /></a></p>

 

Would this not work If i have selected a theme to use in the backend on the pages options??

Have you tried typing out the full directory for where the image is rather than using the <?php bloginfo('template_directory'); ?> ? I don't know but it may be worth trying

Hey all,

 

I have checked the functions file etc and still getting the issue of the header image not displaying now :(

 

This is the code I am using in the header file:

 


<p><a href="<?php echo get_option('home'); ?>"><img src="<?php bloginfo('template_directory'); ?>/images/header2.jpg" alt="<?php bloginfo('name'); ?>" name="logo" width="960" height="272" /></a></p>

Would this not work If i have selected a theme to use in the backend on the pages options??

 

 

 

That code looks fine to me.

You got a test link to have a look at Tony?

Edited by MikeChipshop

I have no idea what file I last made edits too :( I usually have a few of the pages open in notepad ++ and just edit and preview at the same time :)

 

I will try adding that at the start and comparing the files to another theme. I dont make backup copies of my code :( so I have no way of reverting it. Damn.

 

Windows Previous Versions? It can occasionally rescue things. Failing that, store your projects in Dropbox for 30 days' versioning (previous versions don't count toward your storage quota) - plus you can access your files from anywhere, so if you forget something and you're at the client's, you can log in through the web interface and download your files. It'll also sync them between your different machines (and even your phone if you want).

 

I'll be writing up a guide soon on my blog on how to set up a bulletproof development environment on Windows, I'll give you a shout as soon as I've done that.

Edited by Renaissance-Design

  • Author

Have you tried typing out the full directory for where the image is rather than using the <?php bloginfo('template_directory'); ?> ? I don't know but it may be worth trying

 

This worked fine for the whole development, I haven't touched it :(

  • Author

Windows Previous Versions? It can occasionally rescue things. Failing that, store your projects in Dropbox for 30 days' versioning (previous versions don't count toward your storage quota) - plus you can access your files from anywhere, so if you forget something and you're at the client's, you can log in through the web interface and download your files. It'll also sync them between your different machines (and even your phone if you want).

 

I'll be writing up a guide soon on my blog on how to set up a bulletproof development environment on Windows, I'll give you a shout as soon as I've done that.

 

That would be cool :)

  • Author

That code looks fine to me.

You got a test link to have a look at Tony?

 

My link

Edited by ayoungh

  • 2 weeks later...
  • Author

Has anyone else had an issue with there custom theme once they have upgraded. My header image wont load anymore. I think its due to me upgrading the wordpress install?

 

Can anyone help me with this?

 

My code is looking like the following:

 


<a href="<?php echo get_option('home'); ?>"><img src="<?php bloginfo('template_directory'); ?>/images/header2.jpg" alt="<?php bloginfo('name'); ?>" name="logo" width="960" height="272" />

 

My link

You've got links to these JS files just above your footer:

 

<script type="text/javascript" src="scripts/jquery-1.4.3.min.js"></script>

<script type="text/javascript" src="../jquery.nivo.slider.pack.js"></script>

 

Both of them are 404 pages so check to see if the files exist or are at different locations.

  • Author

You've got links to these JS files just above your footer:

 

<script type="text/javascript" src="scripts/jquery-1.4.3.min.js"></script>

<script type="text/javascript" src="../jquery.nivo.slider.pack.js"></script>

 

Both of them are 404 pages so check to see if the files exist or are at different locations.

 

What do you mean?

  • Author

Its working tho? I will check why I have that bit fo code in there when I get home tonight. hmm? Would that effect the static header image?

  • Author

I just found out that the header stopped showing due to the file name having a capital H. why would this suddenly make a difference? It worked before and im sure I didnt change it. :s

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.