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, 08:51 AM
robysan83
 
13 posts · Feb 2016
MODIFY bfa_loop()

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, 07: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, 12: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, 09:04 AM
robysan83
 
13 posts · Feb 2016
I solve it whitout child theme
  #5  
Old Mar 4, 2016, 03: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, 02: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 03:13 PM.

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


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 07:00 PM
Modify Sidebar genuwine4532 Sidebars & Widgets 1 Dec 10, 2012 04:05 AM
Can't Modify Widgets riw777 Sidebars & Widgets 1 Mar 22, 2012 05:40 AM
Modify H1 Headline for SEO idg Post-Kicker, -Byline & -Footer 12 May 4, 2009 10:05 PM


All times are GMT -6. The time now is 12:34 AM.


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