Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

adding text into a specifc area of a wordpress site WordPress

I need to add text to an area of a wordpress blog. It must be able to be changed easily each month without have to code. IE it must be in a widget, post, plugin that someone without skills can change monthly. (like adding text to a post or a widget.)

I have added the orange area into the header because when I posted into page or index or anywhere else it did not show up on every page.

This area and quote must show on evey page of the themes. IE 404, front page, post pages etc.

I can remove orange div area from the header if there is a simple plugin.
I have tried wp greet box, smooth slider and wp insert without luck, (that may be because I have never used them and there is a lack of good information about how to set them up, but I would prefer to stay away from them.)

http://screencast.com/t/MP87ij2Hy
the bottom image is the existing site and the top is what I need it to look like

Answers (6)

2011-05-27

derekshirk answers:

You could register a new widget by placing this in your functions.php file



<?php
register_sidebar( array(
'name' => 'new-text-widget-name',
'id' => 'left-sidebar',
'before_widget' => '<div id="%1$s" class="%2$s widget">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>'
) );

?>




Then place the following in your theme where you want the text to appear:

<?php if (!dynamic_sidebar("new-text-widget-name") ) : ?>
Default right sidebar stuff here…
<?php endif; ?>



---------

This example will create a new simple text widget for you to input text into. Then in order to have this widget output the text you will need to place a tiny bit of php into the page tempates where you want the code to appear. For example you could place the following code into your page.php, single.php, index.php or any other custom page templates you have set up.


Graham Kite comments:

if I do it this way do I still need to add css styling or will this pick up my existing css?


derekshirk comments:

If you place the php code withing your exisiting <div> it should pick up the existing styles that you have. Without looking at your theme files it is hard to say 100% but there will probably be some minor CSS tweaking, but no more than any other method I can think of.

For example if you had:


<div id="OrangeBoxQuoteHere">
<?php if (!dynamic_sidebar("new-text-widget-name") ) : ?>
Default right sidebar stuff here…
<?php endif; ?>
</div>


This should just insert the text for your new widget that you registed in your functions.php into your orange quote box

2011-05-27

Kailey Lampert answers:

I have a "site components" plugin that I use just for this purpose. I'd be happy to email it to you and help you get it setup.


Graham Kite comments:

Hi Kailey that sounds perfect do I post my email here?
I'm new to this site and unsure of the protocol.


Kailey Lampert comments:

I believe if you click on my name, there will be an option to "Send Message." You can use that to send me your email address if you'd prefer not to broadcast it to the world :)

2011-05-27

Andrzej answers:

Use OptionTree plugin:
http://wordpress.org/extend/plugins/option-tree/

Then create custom option in the back-end and add following code to template:

<?php echo get_option_tree('option_name') ?>

use 'option_name' which you just created in back-end.


Graham Kite comments:

This looks very interesting and useful. Is there a page/youtube tutorial or anything out there that shows how to use it?

Looks like it would need a bit of time to set up but would be highly useful once set up.


Andrzej comments:

try this link [[LINK href="http://wptheming.com/2010/11/optiontree-plugin-review/"]]http://wptheming.com/2010/11/optiontree-plugin-review/[[/LINK]]

2011-05-27

Kristin Falkner answers:

You can set up a special category called Quote of the Month, for example. Then create a post and file it under that category with whatever content. To pull it to the header or wherever you would like, use:

<em><?php $my_query = "cat=<strong>CATID#OFQUOTEOFTHEMONTHCATEGORY</strong>&showposts=1"; $my_query = new WP_Query($my_query); ?>
<?php if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); ?>
insert any code for formatting the post content here
<?php endwhile; // end of one post ?>
<?php endif; //end of loop ?>
<?php wp_reset_query(); ?></em>


You can also use the Advanced Category Excluder plug-in to simplify excluding this category from any other loops if you don't know the code to exclude them manually.

As the other answers demonstrate, there are a variety of ways to go about doing this. My method uses posts. You can accomplish what you're trying to do a million different ways.


Graham Kite comments:

Appreciate this but I think it may be a bit beyond me with teh time I have available.


Graham Kite comments:

I realise there are lots of different ways of doing this. Believe it or not I actually tried to outsource this and the guy stuffed the entire sites code. God knows what he did to it, was almost like a total re-write that didn't work.


HMMM thought I had better start again, but have run out of time, and besids that this place is really cool. I'll be back here a more often.


Kristin Falkner comments:

That sucks about the person who messed your theme up. I was just mentioning there were multiple ways to achieve it as I think any of the other answers given here could also work. It's just what you feel comfortable doing and makes more sense for you. I tend to code gravitating more towards the use of posts than widgets but others do the opposite. Good luck!

2011-05-27

Sébastien | French WordpressDesigner answers:

You can use this code in your header.php here you want have the orange zone


<?php
query_posts('post_type=page&pagename=orangezone');//the slug of the page is orangezone

//The Loop
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div id="orange">

<h3>Quote of the month</h3>
<div class="alignleft"><?php the_post_thumbnail( array(100,100) ); ?></div>
<div><?php the_content(); ?></div>

</div>
<?
endwhile;
else:
endif;
//Reset Query
wp_reset_query();
?>


div id="orange" is the orange zone.

You must create a page with this title : orangezone
in this page, add a content and add a post_thumbnail and the orange zone appears in the header. If there is no content and no post_thumbnail, the orange zone disappears.

Of course, you must designed the div with the css


Graham Kite comments:

I think I undersatnd you here, but I should just be able to rename my existing css styling shouldn't I?
Coding is not my strongest suit. I can do it but it takes me more thime than I have right now.


Sébastien | French WordpressDesigner comments:

i can do all (code and css) if you want, but increase your fee to 25$ please. And send me your wordpress login. I can do that in 15 minutes

2011-05-28

paul de wouters answers:

you could use this plugin to format the contents of the widget area: http://wordpress.org/extend/plugins/custom-post-widget/

it enables a WYSIWYG widget and a "content block" custom post type.