Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   New Versions, & Updating (http://forum.bytesforall.com/forumdisplay.php?f=12)
-   -   [SOLVED] child themes or plugins? for tweaks I made to index.php in ATA (http://forum.bytesforall.com/showthread.php?t=18423)

derekwbeck Sep 20, 2012 01:11 AM

[SOLVED] child themes or plugins? for tweaks I made to index.php in ATA
 
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

juggledad Sep 20, 2012 04:19 AM

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.

derekwbeck Sep 25, 2012 07:57 PM

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");
                        }


juggledad Sep 26, 2012 04:11 AM

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

derekwbeck Sep 26, 2012 12:39 PM

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!

juggledad Sep 26, 2012 01:26 PM

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.

derekwbeck Oct 28, 2012 01:42 AM

Thanks, this was helpful. Using a child now on my test site, will make it live soon.


All times are GMT -6. The time now is 12:49 PM.

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