最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - How can I edit the final HTML structure of the whole web page

programmeradmin4浏览0评论

I am creating an online shop web page and I am using the "Almaira Shop" theme.

This theme lets me put a page template that haves a lot of customizable sections that I can edit with the "customize" tool. One of its sections is called Product Filter. It is basically a preview of the shop that shows the categories. It looks like this:

The thing is that I want to change the order of the "Clothing, Other, Sneakers", which is by default on alphabetic order. I cannot change it with the customize tool, so I looked for the file, to edit it, but when I go into the file, it says this code

<?php
if( shortcode_exists( 'almaira-shop' ) ){
do_shortcode("[almaira-shop section='almaira_shop_show_frontpage']");
}
?>

I'm guessing that it is a shortcode from some file, but I can't find it. I did the thing when you press F12 or Ctrl + Shift + I, and the HTML code of the webpage appears like this:

And I managed to change it (Just changing the "Sneakers" at the top of the section, so it would appear first), but when you refresh the web page, the changes disappear because you are only changing it locally. So I was wondering if there would be a way to edit the final HTML structure of the web page so I can change the order with just putting the at the top. :)

I am creating an online shop web page and I am using the "Almaira Shop" theme.

This theme lets me put a page template that haves a lot of customizable sections that I can edit with the "customize" tool. One of its sections is called Product Filter. It is basically a preview of the shop that shows the categories. It looks like this:

The thing is that I want to change the order of the "Clothing, Other, Sneakers", which is by default on alphabetic order. I cannot change it with the customize tool, so I looked for the file, to edit it, but when I go into the file, it says this code

<?php
if( shortcode_exists( 'almaira-shop' ) ){
do_shortcode("[almaira-shop section='almaira_shop_show_frontpage']");
}
?>

I'm guessing that it is a shortcode from some file, but I can't find it. I did the thing when you press F12 or Ctrl + Shift + I, and the HTML code of the webpage appears like this:

And I managed to change it (Just changing the "Sneakers" at the top of the section, so it would appear first), but when you refresh the web page, the changes disappear because you are only changing it locally. So I was wondering if there would be a way to edit the final HTML structure of the web page so I can change the order with just putting the at the top. :)

Share Improve this question asked Apr 15, 2020 at 20:26 Santyx2033Santyx2033 1 5
  • Your best bet is going to be to contact the developer of the Almaira Shop Theme. The shortcode that gets generated is controlled by the theme itself so what you'd need to do is actually edit or augment that chunk of code and that would then mean you either can't update from that point forward or if you do update, your code will get overwritten and you'll have to start over. Are you by any chance using a Child Theme to give yourself more flexibility? – Tony Djukic Commented Apr 15, 2020 at 22:16
  • Thanks. I'm not using a child theme, do I have to create it or something? I will get in contact with the developers, thanks again – Santyx2033 Commented Apr 16, 2020 at 2:47
  • Just be aware that this is generally not how WordPress or any of these plugins work. They don't produce HTML that could can edit arbitrarily. However plugins might let you replace parts of the templates that they use. The exact methods allowed will depend on the theme or plugin in question. – Jacob Peattie Commented Apr 16, 2020 at 6:00
  • Ok thank you :) – Santyx2033 Commented Apr 16, 2020 at 18:37
  • When you changed it in the inspector it does not change it on your server. – Nate Commented Apr 29, 2020 at 1:54
Add a comment  | 

1 Answer 1

Reset to default 0

This theme has a companion plugin called hunk-companion.

I ssh'd to my server and did grep -iRl "almaira_shop_show_frontpage" inside the wp-content folder and it returned this:

plugins/hunk-companion/almaira-shop/almaira-shop-admin/almaira_shop_shortcode.php

I found that in plugins/hunk-companion/almaira-shop/almaira-shop-frontpage you have all the sections' .php files.

You can now copy the code you need into your own page template file to create your custom frontpage in your child theme (that's what I'm about to do!).

Good Luck!

发布评论

评论列表(0)

  1. 暂无评论