Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Montezuma Theme »

How to: add an alert box on the front page


  #1  
Old Oct 7, 2015, 04:51 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
I've had several cases where a client wants to have an alert show up on the front page -like a 'No School" announcement. Here is how to do it.

1) make sure you have the plugin 'exec-php' installed
2) go to MTO->Main Templates->+ Add main template
3) enter the name 'front-page' and copy 'index' and add the new template
4) edit the new 'front-page.php'
5) right after the line
HTML Code:
<?php get_header(); ?>
add
HTML Code:
<div id="fp-announce">
    <?php dynamic_sidebar( 'front page alert' ); ?> 
</div>
and press the 'SAVE Changes' button
6) go to Appearances->Widgets and you should see a new widget area 'front page alert'
7) add a text widget to the new widget area and insert the following code into it
HTML Code:
<?php 
# ================================================ 
#      CODE for announcement on front page box       
# ================================================ 
if ( is_front_page() ) { 
		$my_query = new WP_Query('category_name=announcement&showposts=1' );
		while ($my_query->have_posts()) : $my_query->the_post(); ?>
		<div class="announce row">
				<br/>
			<h3 style="text-align: center; color: #797C00;">Special Announcement</h3>
				<?php the_content(); ?>
				<br/><br/>
		</div>
		<?php endwhile; 
} 
# ================================================ 
#   end of CODE for announcement on front page box       
# ================================================ 
?>
8) go to MTO->CSS Files->various.css - scroll to the bottom and add the following
HTML Code:
div#fp-announce {background-color: yellow; margin-bottom: 0px;}
9) add a new category (posts->category) called 'annoucement'

Now when you want an annoucement to show on the front page, just create a post and give it the category 'annoucement' and it will show up. You can change the background color in the CSS to what ever you want.

NOTE: give the post a date of a year ago so it won't show up on the first page of your posts in addition of being on the front page.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
PATCH 3723-01: Wrong META title when Front Page is a static page juggledad Old Version fixes and change logs 0 Mar 4, 2015 03:20 AM
Quick Alert: MP6 plugin v2.0 breaks the Atahualpa admin menu DarrenTurpin Atahualpa 3 Wordpress theme 2 Sep 5, 2013 01:58 AM
[SOLVED] Website Defender Alert: Source code disclosure db65 New Versions, & Updating 4 Oct 26, 2011 02:44 PM
Duplicate Content Alert And A Feature Suggestion flyboy Comments, trackbacks & pings 5 Oct 1, 2010 04:27 PM
Default Non-static Front Page (Home Page) Is Missing (Atahualpa Theme) SavvyBaker Center area post/pages 0 Jan 18, 2010 04:02 PM


All times are GMT -6. The time now is 08:20 PM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.