Plugin child Wordpress





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I want to add the next line to one of files of woocommerce in concrete: wp-contentpluginswoocommercetemplatesarchive-product.php






<div class="breadcrumps-header"><?php if ( function_exists( 'yoast_breadcrumb' ) ) {yoast_breadcrumb();} ?></div>





But in the next update of Woocommerce I'll loose the modification. How can I do it to add like plugin chlid?










share|improve this question























  • Check if the template in question has any hooks in that region that could be used to insert the content from the outside; if not, you can declare “woocommerce support” within your own theme, and overwrite specific WC template files from there afterwards.

    – misorude
    Nov 16 '18 at 14:34











  • Are you using child theme?

    – zipkundan
    Nov 16 '18 at 14:37











  • First of all, I would recommend to find a hook for the breadcrump first. If there is, you might be able to adding your code using the hook. The php file should be place in your child theme folder or new plugin folder to prevent deleting by update.

    – idpokute
    Nov 16 '18 at 16:20


















0















I want to add the next line to one of files of woocommerce in concrete: wp-contentpluginswoocommercetemplatesarchive-product.php






<div class="breadcrumps-header"><?php if ( function_exists( 'yoast_breadcrumb' ) ) {yoast_breadcrumb();} ?></div>





But in the next update of Woocommerce I'll loose the modification. How can I do it to add like plugin chlid?










share|improve this question























  • Check if the template in question has any hooks in that region that could be used to insert the content from the outside; if not, you can declare “woocommerce support” within your own theme, and overwrite specific WC template files from there afterwards.

    – misorude
    Nov 16 '18 at 14:34











  • Are you using child theme?

    – zipkundan
    Nov 16 '18 at 14:37











  • First of all, I would recommend to find a hook for the breadcrump first. If there is, you might be able to adding your code using the hook. The php file should be place in your child theme folder or new plugin folder to prevent deleting by update.

    – idpokute
    Nov 16 '18 at 16:20














0












0








0








I want to add the next line to one of files of woocommerce in concrete: wp-contentpluginswoocommercetemplatesarchive-product.php






<div class="breadcrumps-header"><?php if ( function_exists( 'yoast_breadcrumb' ) ) {yoast_breadcrumb();} ?></div>





But in the next update of Woocommerce I'll loose the modification. How can I do it to add like plugin chlid?










share|improve this question














I want to add the next line to one of files of woocommerce in concrete: wp-contentpluginswoocommercetemplatesarchive-product.php






<div class="breadcrumps-header"><?php if ( function_exists( 'yoast_breadcrumb' ) ) {yoast_breadcrumb();} ?></div>





But in the next update of Woocommerce I'll loose the modification. How can I do it to add like plugin chlid?






<div class="breadcrumps-header"><?php if ( function_exists( 'yoast_breadcrumb' ) ) {yoast_breadcrumb();} ?></div>





<div class="breadcrumps-header"><?php if ( function_exists( 'yoast_breadcrumb' ) ) {yoast_breadcrumb();} ?></div>






php wordpress plugins woocommerce breadcrumbs






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 16 '18 at 14:27









LauramisidroLauramisidro

204




204













  • Check if the template in question has any hooks in that region that could be used to insert the content from the outside; if not, you can declare “woocommerce support” within your own theme, and overwrite specific WC template files from there afterwards.

    – misorude
    Nov 16 '18 at 14:34











  • Are you using child theme?

    – zipkundan
    Nov 16 '18 at 14:37











  • First of all, I would recommend to find a hook for the breadcrump first. If there is, you might be able to adding your code using the hook. The php file should be place in your child theme folder or new plugin folder to prevent deleting by update.

    – idpokute
    Nov 16 '18 at 16:20



















  • Check if the template in question has any hooks in that region that could be used to insert the content from the outside; if not, you can declare “woocommerce support” within your own theme, and overwrite specific WC template files from there afterwards.

    – misorude
    Nov 16 '18 at 14:34











  • Are you using child theme?

    – zipkundan
    Nov 16 '18 at 14:37











  • First of all, I would recommend to find a hook for the breadcrump first. If there is, you might be able to adding your code using the hook. The php file should be place in your child theme folder or new plugin folder to prevent deleting by update.

    – idpokute
    Nov 16 '18 at 16:20

















Check if the template in question has any hooks in that region that could be used to insert the content from the outside; if not, you can declare “woocommerce support” within your own theme, and overwrite specific WC template files from there afterwards.

– misorude
Nov 16 '18 at 14:34





Check if the template in question has any hooks in that region that could be used to insert the content from the outside; if not, you can declare “woocommerce support” within your own theme, and overwrite specific WC template files from there afterwards.

– misorude
Nov 16 '18 at 14:34













Are you using child theme?

– zipkundan
Nov 16 '18 at 14:37





Are you using child theme?

– zipkundan
Nov 16 '18 at 14:37













First of all, I would recommend to find a hook for the breadcrump first. If there is, you might be able to adding your code using the hook. The php file should be place in your child theme folder or new plugin folder to prevent deleting by update.

– idpokute
Nov 16 '18 at 16:20





First of all, I would recommend to find a hook for the breadcrump first. If there is, you might be able to adding your code using the hook. The php file should be place in your child theme folder or new plugin folder to prevent deleting by update.

– idpokute
Nov 16 '18 at 16:20












2 Answers
2






active

oldest

votes


















1














If you look at that file (https://github.com/woocommerce/woocommerce/blob/v2.2.3/templates/archive-product.php), you'll see a number of different actions you can use depending on where you want that content inserted.



For example, near the top there's this:



    /**
* woocommerce_before_main_content hook
*
* @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
* @hooked woocommerce_breadcrumb - 20
*/
do_action( 'woocommerce_before_main_content' );


The comment shows that woocommerce's own breadcrumbs are hooked to this action with a priority of 20.



If you wanted your code to appear after this, you should be able to add something like the following to your theme's functions.php (or somewhere else):



add_action('woocommerce_before_main_content', function() { ?>
<div class="breadcrumps-header">
<?php if ( function_exists( 'yoast_breadcrumb' ) ) {yoast_breadcrumb();} ?>
</div>
<?php });


25 is the priority, ensuring your code will execute after woocommerce's woocommerce_breadcrumb function.



There are lots of other do_actions in that script, so choose the one closest to where you want your code and you should get what you need with a little experimentation.






share|improve this answer
























  • Thanks a lot!!!!! I installed "code snippets plugin" and I have added your code and it worked perfectly!

    – Lauramisidro
    Nov 20 '18 at 7:59











  • You're welcome! Glad to hear it was what you needed.

    – John O
    Nov 20 '18 at 18:07



















1














If you create folder in your theme and name it woocommerce and copy all files from wp-contentpluginswoocommercetemplates to your wp-contentthemesyourthemenamewoocommerce you can place changes to this file and after next WooCommerce update it will not lost, only it will show you that you use old version of template if they placed changes to the same original file and you will have to manually merge them. And create child theme first if it's not your own theme, don't place woocommerce folder to original theme.



And, better to put div inside if, because you don't want to show empty div if this function doesn't exist, right?



<?php if ( function_exists( 'yoast_breadcrumb' ) ) { ?>
<div class="breadcrumps-header"><?php yoast_breadcrumb(); ?></div>
<?php } ?>





share|improve this answer


























  • Hi!! Thanks for your answer. I tested your way but I don't like, anyway It's very easy to do. Thanks a lot

    – Lauramisidro
    Nov 20 '18 at 7:52












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339779%2fplugin-child-wordpress%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














If you look at that file (https://github.com/woocommerce/woocommerce/blob/v2.2.3/templates/archive-product.php), you'll see a number of different actions you can use depending on where you want that content inserted.



For example, near the top there's this:



    /**
* woocommerce_before_main_content hook
*
* @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
* @hooked woocommerce_breadcrumb - 20
*/
do_action( 'woocommerce_before_main_content' );


The comment shows that woocommerce's own breadcrumbs are hooked to this action with a priority of 20.



If you wanted your code to appear after this, you should be able to add something like the following to your theme's functions.php (or somewhere else):



add_action('woocommerce_before_main_content', function() { ?>
<div class="breadcrumps-header">
<?php if ( function_exists( 'yoast_breadcrumb' ) ) {yoast_breadcrumb();} ?>
</div>
<?php });


25 is the priority, ensuring your code will execute after woocommerce's woocommerce_breadcrumb function.



There are lots of other do_actions in that script, so choose the one closest to where you want your code and you should get what you need with a little experimentation.






share|improve this answer
























  • Thanks a lot!!!!! I installed "code snippets plugin" and I have added your code and it worked perfectly!

    – Lauramisidro
    Nov 20 '18 at 7:59











  • You're welcome! Glad to hear it was what you needed.

    – John O
    Nov 20 '18 at 18:07
















1














If you look at that file (https://github.com/woocommerce/woocommerce/blob/v2.2.3/templates/archive-product.php), you'll see a number of different actions you can use depending on where you want that content inserted.



For example, near the top there's this:



    /**
* woocommerce_before_main_content hook
*
* @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
* @hooked woocommerce_breadcrumb - 20
*/
do_action( 'woocommerce_before_main_content' );


The comment shows that woocommerce's own breadcrumbs are hooked to this action with a priority of 20.



If you wanted your code to appear after this, you should be able to add something like the following to your theme's functions.php (or somewhere else):



add_action('woocommerce_before_main_content', function() { ?>
<div class="breadcrumps-header">
<?php if ( function_exists( 'yoast_breadcrumb' ) ) {yoast_breadcrumb();} ?>
</div>
<?php });


25 is the priority, ensuring your code will execute after woocommerce's woocommerce_breadcrumb function.



There are lots of other do_actions in that script, so choose the one closest to where you want your code and you should get what you need with a little experimentation.






share|improve this answer
























  • Thanks a lot!!!!! I installed "code snippets plugin" and I have added your code and it worked perfectly!

    – Lauramisidro
    Nov 20 '18 at 7:59











  • You're welcome! Glad to hear it was what you needed.

    – John O
    Nov 20 '18 at 18:07














1












1








1







If you look at that file (https://github.com/woocommerce/woocommerce/blob/v2.2.3/templates/archive-product.php), you'll see a number of different actions you can use depending on where you want that content inserted.



For example, near the top there's this:



    /**
* woocommerce_before_main_content hook
*
* @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
* @hooked woocommerce_breadcrumb - 20
*/
do_action( 'woocommerce_before_main_content' );


The comment shows that woocommerce's own breadcrumbs are hooked to this action with a priority of 20.



If you wanted your code to appear after this, you should be able to add something like the following to your theme's functions.php (or somewhere else):



add_action('woocommerce_before_main_content', function() { ?>
<div class="breadcrumps-header">
<?php if ( function_exists( 'yoast_breadcrumb' ) ) {yoast_breadcrumb();} ?>
</div>
<?php });


25 is the priority, ensuring your code will execute after woocommerce's woocommerce_breadcrumb function.



There are lots of other do_actions in that script, so choose the one closest to where you want your code and you should get what you need with a little experimentation.






share|improve this answer













If you look at that file (https://github.com/woocommerce/woocommerce/blob/v2.2.3/templates/archive-product.php), you'll see a number of different actions you can use depending on where you want that content inserted.



For example, near the top there's this:



    /**
* woocommerce_before_main_content hook
*
* @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
* @hooked woocommerce_breadcrumb - 20
*/
do_action( 'woocommerce_before_main_content' );


The comment shows that woocommerce's own breadcrumbs are hooked to this action with a priority of 20.



If you wanted your code to appear after this, you should be able to add something like the following to your theme's functions.php (or somewhere else):



add_action('woocommerce_before_main_content', function() { ?>
<div class="breadcrumps-header">
<?php if ( function_exists( 'yoast_breadcrumb' ) ) {yoast_breadcrumb();} ?>
</div>
<?php });


25 is the priority, ensuring your code will execute after woocommerce's woocommerce_breadcrumb function.



There are lots of other do_actions in that script, so choose the one closest to where you want your code and you should get what you need with a little experimentation.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 16 '18 at 16:20









John OJohn O

333411




333411













  • Thanks a lot!!!!! I installed "code snippets plugin" and I have added your code and it worked perfectly!

    – Lauramisidro
    Nov 20 '18 at 7:59











  • You're welcome! Glad to hear it was what you needed.

    – John O
    Nov 20 '18 at 18:07



















  • Thanks a lot!!!!! I installed "code snippets plugin" and I have added your code and it worked perfectly!

    – Lauramisidro
    Nov 20 '18 at 7:59











  • You're welcome! Glad to hear it was what you needed.

    – John O
    Nov 20 '18 at 18:07

















Thanks a lot!!!!! I installed "code snippets plugin" and I have added your code and it worked perfectly!

– Lauramisidro
Nov 20 '18 at 7:59





Thanks a lot!!!!! I installed "code snippets plugin" and I have added your code and it worked perfectly!

– Lauramisidro
Nov 20 '18 at 7:59













You're welcome! Glad to hear it was what you needed.

– John O
Nov 20 '18 at 18:07





You're welcome! Glad to hear it was what you needed.

– John O
Nov 20 '18 at 18:07













1














If you create folder in your theme and name it woocommerce and copy all files from wp-contentpluginswoocommercetemplates to your wp-contentthemesyourthemenamewoocommerce you can place changes to this file and after next WooCommerce update it will not lost, only it will show you that you use old version of template if they placed changes to the same original file and you will have to manually merge them. And create child theme first if it's not your own theme, don't place woocommerce folder to original theme.



And, better to put div inside if, because you don't want to show empty div if this function doesn't exist, right?



<?php if ( function_exists( 'yoast_breadcrumb' ) ) { ?>
<div class="breadcrumps-header"><?php yoast_breadcrumb(); ?></div>
<?php } ?>





share|improve this answer


























  • Hi!! Thanks for your answer. I tested your way but I don't like, anyway It's very easy to do. Thanks a lot

    – Lauramisidro
    Nov 20 '18 at 7:52
















1














If you create folder in your theme and name it woocommerce and copy all files from wp-contentpluginswoocommercetemplates to your wp-contentthemesyourthemenamewoocommerce you can place changes to this file and after next WooCommerce update it will not lost, only it will show you that you use old version of template if they placed changes to the same original file and you will have to manually merge them. And create child theme first if it's not your own theme, don't place woocommerce folder to original theme.



And, better to put div inside if, because you don't want to show empty div if this function doesn't exist, right?



<?php if ( function_exists( 'yoast_breadcrumb' ) ) { ?>
<div class="breadcrumps-header"><?php yoast_breadcrumb(); ?></div>
<?php } ?>





share|improve this answer


























  • Hi!! Thanks for your answer. I tested your way but I don't like, anyway It's very easy to do. Thanks a lot

    – Lauramisidro
    Nov 20 '18 at 7:52














1












1








1







If you create folder in your theme and name it woocommerce and copy all files from wp-contentpluginswoocommercetemplates to your wp-contentthemesyourthemenamewoocommerce you can place changes to this file and after next WooCommerce update it will not lost, only it will show you that you use old version of template if they placed changes to the same original file and you will have to manually merge them. And create child theme first if it's not your own theme, don't place woocommerce folder to original theme.



And, better to put div inside if, because you don't want to show empty div if this function doesn't exist, right?



<?php if ( function_exists( 'yoast_breadcrumb' ) ) { ?>
<div class="breadcrumps-header"><?php yoast_breadcrumb(); ?></div>
<?php } ?>





share|improve this answer















If you create folder in your theme and name it woocommerce and copy all files from wp-contentpluginswoocommercetemplates to your wp-contentthemesyourthemenamewoocommerce you can place changes to this file and after next WooCommerce update it will not lost, only it will show you that you use old version of template if they placed changes to the same original file and you will have to manually merge them. And create child theme first if it's not your own theme, don't place woocommerce folder to original theme.



And, better to put div inside if, because you don't want to show empty div if this function doesn't exist, right?



<?php if ( function_exists( 'yoast_breadcrumb' ) ) { ?>
<div class="breadcrumps-header"><?php yoast_breadcrumb(); ?></div>
<?php } ?>






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 16 '18 at 16:32

























answered Nov 16 '18 at 16:14









amedvamedv

303112




303112













  • Hi!! Thanks for your answer. I tested your way but I don't like, anyway It's very easy to do. Thanks a lot

    – Lauramisidro
    Nov 20 '18 at 7:52



















  • Hi!! Thanks for your answer. I tested your way but I don't like, anyway It's very easy to do. Thanks a lot

    – Lauramisidro
    Nov 20 '18 at 7:52

















Hi!! Thanks for your answer. I tested your way but I don't like, anyway It's very easy to do. Thanks a lot

– Lauramisidro
Nov 20 '18 at 7:52





Hi!! Thanks for your answer. I tested your way but I don't like, anyway It's very easy to do. Thanks a lot

– Lauramisidro
Nov 20 '18 at 7:52


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339779%2fplugin-child-wordpress%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

The Sandy Post

Danny Elfman

Pages that link to "Head v. Amoskeag Manufacturing Co."