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 » Atahualpa 3 Wordpress theme » New Versions, & Updating »

[SOLVED] child themes or plugins? for tweaks I made to index.php in ATA


  #1  
Old Sep 20, 2012, 01:11 AM
derekwbeck
 
151 posts · Nov 2010
Okay, so you remember the good old days, when we could put php before, in, after the loop? Well, then WP got strict, forced ATA to turn this off. So I, like many, started hard-coding the tweaks into index.php. But then, with every ATA update, I get slightly annoyed and don't want to update, for the dread of editing my index.php yet again. There's got to be a better way.

I'm slowly learning of plugins, and got my header.php updated this way now. But, how do I do things like:

Code:
<?php include("social-sitemenu.php"); ?>
right before this line index.php:
Code:
<?php bfa_next_previous_page_links('Top'); // For MULTI post pages if activated at ATO -> Next/Previous Navigation:  ?>
Or,

How do I replace this line of index.php:
Code:
<?php bfa_post_headline('<div class="post-headline">','</div>'); ?> <!--original-->
with
Code:
<?php if (!is_page()) {bfa_post_headline('<div class="post-headline">','</div>'); } ?>

Or, lastly, how do I do this sort of stuff in the loop:
Code:
<?php 
			if ( is_front_page() OR is_page() ) { 
				/*do nothing, no social menu on pages*/
			} else { if ( is_single() ) {
				include("social-postmenu.php");
			} }
?>
How do I accomplish things like the above? Do I need to learn child themes? Can I do it with a custom-made plugin (and if so, what hooks do I use to make this stuff happen?) Are there any sticky posts on life with ATA after the no-php inserts?

Thanks,
Derek
  #2  
Old Sep 20, 2012, 04:19 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
you could build a child theme - you'll need a copy of index.php and style.css
you have to edit style.css to
1 - change the name of the theme to whatever you want
2 - add a line in the comments
HTML Code:
Template: Atahualpa
make sure that the name is the name of the folder Atahualpa is in stalled in so if you installed atahualpa in a folder called 'atahualpa379' that line would be
HTML Code:
Template: Atahualpa379
3 - change the 'Version' line in the comments to your own version number for tracking

You still will need to keep tabs of changes in index.php in case there are changes - I suggest you put another copy of index.php into the child theme folder and call it indexphp.base. Then when a new release of Atahualpa comes out you can compare the new index.php to indexphp.base to see if there were any changes.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Sep 25, 2012, 07:57 PM
derekwbeck
 
151 posts · Nov 2010
To minimize affects of changes by the main theme, is there a way to hook into the original index.php?

For example, instead of merely copying the entire index.php to my child theme, can I somehow filter or append (like add_action in wordpress):

Code:
		
<?php bfa_post_pagination('<p class="post-pagination"><strong>'.__('Pages:','atahualpa').'</strong>','</p>'); ?>
with the following to appear afterward:

Code:
			if ( is_front_page() ) {
				include("compactteasers.php");
			}
  #4  
Old Sep 26, 2012, 04:11 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
If you could, you would still be changing the index.php and have the same issue, you would need to compare it against the previous version
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #5  
Old Sep 26, 2012, 12:39 PM
derekwbeck
 
151 posts · Nov 2010
Okay, I understand. But just to confirm (sorry if I'm slow ...

There's no way to hook into the theme with pre-existing function calls? At least, not in the case above?

Thanks again!
  #6  
Old Sep 26, 2012, 01:26 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
you can add new functions to the child theme by coding a function.php and adding the new code there - it will be added to the end of the themes function.php - BUT you have to edit the code somewhere else to call that new function.

you may want to read about child themes at wordpress.org or do a google search about them.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #7  
Old Oct 28, 2012, 01:42 AM
derekwbeck
 
151 posts · Nov 2010
Thanks, this was helpful. Using a child now on my test site, will make it live soon.

Bookmarks

Tags
child themes, index.php, php, plugins

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Atahualpa child themes + Thesis look-a-like everyman New Versions, & Updating 3 Feb 11, 2010 11:42 AM
Child themes David Latapie Header configuration & styling 3 Nov 2, 2009 05:33 AM


All times are GMT -6. The time now is 02:25 AM.


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