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 »

MODIFY bfa_loop()


  #1  
Old Mar 3, 2016, 09:51 AM
robysan83
 
13 posts · Feb 2016
Hi,
I have a question.
If I should change the bfa_loop( ) function to show the post at the start page, with this structure:

Last Post for category one
______________________
Last Post for category two
______________________
Last Post for category three
______________________
Last Post for category four

Basically , I want to show the last article for all single category in my blog.
I saw that the bfa_loop function( ), show all article regardless of category.
Can I change the bfa_loop( ) fuction without the change is lost in case update theme?
  #2  
Old Mar 3, 2016, 08:52 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Any change to the themes code will be lost over an update of the theme.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Mar 4, 2016, 01:44 AM
robysan83
 
13 posts · Feb 2016
Quote:
Originally Posted by juggledad
Any change to the themes code will be lost over an update of the theme.
Yes, I imagined it was so.
But if if you employ the child theme WP functionality, changing montezuma code, you could have user to able a child theme to redefine a function in parent.
For example for bfa_loop() you should change montezumas'code with this:
Code:
if (!function_exists( 'bfa_loop' ) ){
   function bfa_loop() {
     ....
   }
}
Exploiting the mechanism of child theme, I can create a file in directory includes/ of my child theme to redefine bfa_loop function and include it whitout an redeclaration error.
To do this, however, we should change the montezuma's core.
I hope you have understood me.
  #4  
Old Mar 4, 2016, 10:04 AM
robysan83
 
13 posts · Feb 2016
I solve it whitout child theme
  #5  
Old Mar 4, 2016, 04:00 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Care to explain your solution for others?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #6  
Old Mar 5, 2016, 03:56 PM
robysan83
 
13 posts · Feb 2016
I have create a virtual main template named home.php in Montezuma Options -> Main Templates, with this code:
Code:
<!--<div id="container">-->

<?php get_header(); ?>

<div id="main" class="row">
        
        <div id="widgetarea-one" class="col4">
		<?php dynamic_sidebar( 'Widget Area ONE' ); ?>
	</div>

	<div id="content" class="cf col8">
		
		<div class="my-category">
              		<?php bfa_custom_query( 'category_name=category_oneshowposts=1' ); ?>
                  
                	<?php bfa_loop( 'postformat' ); ?>
              </div>
              <div class="my-category">
              		<?php bfa_custom_query( 'category_name=category_two&showposts=1' ); ?>
                  
                	<?php bfa_loop( 'postformat' ); ?>
              </div>
              <div class="my-category">
              		<?php bfa_custom_query( 'category_name=category_three&showposts=1' ); ?>
                  
                	<?php bfa_loop( 'postformat' ); ?>
              </div>
              <div class="my-category">
              		<?php bfa_custom_query( 'category_name=category_four&showposts=1' ); ?>
                  
                	<?php bfa_loop( 'postformat' ); ?>
              </div
	</div>
	
	<div id="widgetarea-two" class="col4">
		<?php dynamic_sidebar( 'Widget Area TWO' ); ?>
	</div>

</div>
	
<?php get_footer(); ?>

<!--</div>-->
This code, create four section, one for each Post's category and show only last Post of each category, by executing query_post() function before loop.
After, I have create a Page named Home and I assigned the Virtual Main Template home.php created, by dropdown "Virtual Template" on the right bottom.
Finally, I assigned in WP -> Read -> Front page displayes, A static page (select below) -> Front page: Home.

Last edited by robysan83; Mar 5, 2016 at 04:13 PM.
  #7  
Old Mar 5, 2016, 07:21 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Nicely done! And thanks for sharing.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
RFE: callback function passed to bfa_loop for Not Found processing marklevine Montezuma Theme 0 Jul 27, 2014 08:00 PM
Modify Sidebar genuwine4532 Sidebars & Widgets 1 Dec 10, 2012 05:05 AM
Can't Modify Widgets riw777 Sidebars & Widgets 1 Mar 22, 2012 06:40 AM
Modify H1 Headline for SEO idg Post-Kicker, -Byline & -Footer 12 May 4, 2009 11:05 PM


All times are GMT -6. The time now is 11:14 PM.


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