php - How to change the structureorder of sections in a Wordpress theme?

Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress.

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 5 years ago.

Improve this question

I am using a Wordpress theme called "business-one-page", here is a link to the demo of the theme: Buisness-One-Page. I am trying to change the structure of the sections. This is a one page theme so what i want to do is re-order the sections and make for example about section display after the service section.

I am using a child theme and have been trying to locate the .php file that has the structure to copy and change into my child theme directory, but can´t find it. Is it possible to do this ?

Thanks in Advance

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 5 years ago.

Improve this question

I am using a Wordpress theme called "business-one-page", here is a link to the demo of the theme: Buisness-One-Page. I am trying to change the structure of the sections. This is a one page theme so what i want to do is re-order the sections and make for example about section display after the service section.

I am using a child theme and have been trying to locate the .php file that has the structure to copy and change into my child theme directory, but can´t find it. Is it possible to do this ?

Thanks in Advance

Share Improve this question asked Aug 21, 2019 at 10:45 davidhlynsdavidhlyns 178 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 1

I'm looking at the free version. The relevant code is in inc/extras.php, and it looks like there are filters to enable / disable sections (business_one_page_ed_<section>_section) and to change the titles of sections (business_one_page_<section>_section_menu_title), but not reorder them:

function business_one_page_get_sections(){
    $sections = array( 'about', 'services', 'cta1', 'portfolio', 'team', 'clients', 'blog',
                       'testimonial', 'cta2', 'contact' );
    $enabled_section = array();
    foreach ( $sections as $section ){
        if ( esc_attr( get_theme_mod( 'business_one_page_ed_' . $section . '_section' ) ) == 1 ){
            $enabled_section[] = array(
                'id' => $section,
                'menu_text' => esc_attr( get_theme_mod( 'business_one_page_' . $section .
                                                        '_section_menu_title','' ) ),
            );
        }
    }
    return $enabled_section;
}

To let you reorder the sections they'd have to filter $sections before processing them or filter $enabled_section before it's returned. Nor is this function pluggable i.e. you can't just overwrite it wholesale (without monkey patching tricks)

So you're going to have to edit the theme, and either

  1. change the order here
  2. add a filter either to the original value of $sections or to $enabled_section so you can edit the order in your filter, and then hook that filter in your child theme

However either will be lost if you update the theme. If you've paid for the theme, or even if you haven't, it might be worth asking Rara Theme if they can add a filter or customisation option here for you for future versions.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745228277a4617564.html

相关推荐

  • php - How to change the structureorder of sections in a Wordpress theme?

    Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress.

    4小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信