How to Create custom woocommerce dashboard Template - wordpress

I am trying to create custom woocommerce dashboard for my custom wordpress theme, but i found a error message when i am trying to create custom woocommerce dashboard template.
Deprecated: Your theme version of my-account.php template is deprecated since version 2.6! Use the latest version, which supports multiple account pages and navigation, from WC 2.6.0 instead.
I have followed the woocommerce template pattern (yourtheme/woocommerce/myaccount/my-account.php.) but nothing help . Please see the attached image. problem will gone if i edit wp-config.php with define( 'WP_DEBUG_DISPLAY', false );
Thanks

I found a solution for this.
I have to use this two function in my-account.php file.
Then the error message gone.
do_action( 'woocommerce_account_navigation' );
do_action( 'woocommerce_account_content' );

Related

'use fusion builder' is not appearing in wordpress Avada theme

I have installed the AVADA theme's plugin Fusion Builder. System status is all ok.
but when I'm going to add a new page. It is not showing the 'use fusion builder' option.
I am done with updating the wordpress and all other plugins.
I have also tried making Fusion builder auto activation on. Still its not working.
Make sure Fusion Builder is enabled in Fusion Builder > Settings. Under Post Types, check the box next to the post types (post, page, etc.) with which you want to use Fusion Builder.
It seems that the Gutenberge Block editor may be the resons for your problem. The following code will de-register the block editor to re-solve the issue.
Please add the script to the functions.php : after_setup_theme action hook
add_action( 'after_setup_theme', 'tristup_setup' );
function tristup_setup()
{
add_filter('use_block_editor_for_post', '__return_false', 10);
// disable for post types
add_filter('use_block_editor_for_post_type', '__return_false', 10);
}
hope this will solve your problem.

After editing my wordpress website's footer copyright credites using My Custom Functions plugin, my site is down

I am making a wordpress store using storefront theme named Pakoutfit.com.
I tried to edit its footer credentials using My Custom Functions plugin and using this plugin I run following code,
add-action( 'init' , 'custom_remove_footer_credit' , 10 );
function custom_remove_footer_credit(){
remove_action( 'storefront_footer' , 'storefront_credit' , 20 );
add_action( 'storefront_footer' , 'custom_storefront_credit' , 20 );
}
function custom_storefront_credit(){
?>
<div class="site-info">
© PakOutfit <?php echo get_the_date( 'Y' ); ?>
</div>
<?php
}
I do that following this youtube tutorial,
Now when I tried to open my site or even its wp-admin panel it says,
This page isn’t working
pakoutfit.com is currently unable to handle this request.
HTTP ERROR 500
I dont know that in which file My custom Functions plugin make changes so that I can reverse them.
I am using godaddy domain name and hosting.
I am new in this field. Please help me to make my site live again. Thanks
Modification to your site should be made via a WordPress child theme. Do not edit core theme files: https://codex.wordpress.org/Child_Themes
Using your FTP or cPanel login, locate the file where you made the changes and remove them. That will restore your site.
Once you have your child theme installed and activated, and your function to the child theme functions.php file.
Be sure to change this:
add-action
To this:
add_action

template option missing at wordpress dashboard

I am very new at wordpress theme development. I am facing a problem over and again. The problem is the below . template option missing at wordpress dashboard.how can i visible template option at wordpress dashboard.
first you need to create a template,then after it will show in dashboard
<?php
/*
Template Name: My Custom Page
*/
?>
put the code on your template file and check you will see the option

How to make a wordpress theme woocommerce compatible?

How can I make a wordpress theme woocommerce compatible ? I want to make cart page, my account page, product loop page, product single page,checkout page design into my wordpress theme.
We Can make WordPress theme compatible with woocommerce here is how you can do that
There are two ways to resolve this:
1] Using woocommerce_content() -
This solution allows you to create a new template page within your theme that will be used for all WooCommerce taxonomy and post type displays.
To set up this template page, perform the following steps:
Duplicate page.php-
Duplicate your theme’s page.php file, and name it woocommerce.php. This file should be found like this: wp-content/themes/YOURTHEME/woocommerce.php.
Edit your page (woocommerce.php)-
Open up your newly created woocommerce.php in a text editor, or the editor of your choice.
Replace the loop-
In woocommerce.php, replace the Loop with woocommerce_content();
i.e., instead of if(have_posts)… endif; should be replaced by
woocommerce_content()
This will ensure that the WooCommerce templates are picked up for the product and taxonomy pages.
2] Using WooCommerce Hooks-
The hook method is more involved that using woocommerce_content, but is more flexible. This is similar to the method we use when creating our themes. By inserting a few lines in your theme’s functions.php file, First unhook the WooCommerce wrappers;
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
Then hook in your own functions to display the wrappers your theme requires:
add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10);
add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10); function my_theme_wrapper_start() {
echo '<section id="main">';} function my_theme_wrapper_end() {
echo '</section>';}
3] Declare WooCommerce support -
Now that you have made the changes, the final thing you have to do, is specify that your theme now supports WooCommerce. You need to add the following in functions.php of your theme.
add_action( 'after_setup_theme', 'woocommerce_support' );
function woocommerce_support() {
add_theme_support( 'woocommerce' );
}
To make it more practical for you this is the video for you, which you
can follow too- How To Make WordPress Theme Compatible With WooCommerce Plugin
You need to install WooC and look at the all the style tags that come accross with it then you can style up the pages and add all of that to your style sheet.
Also you can use hooks but Im not 100% sure how you would check if WooC is active off the top of my head so that hooks in your code only come up when the plugin is active.

Wordpress plugin shortscodes in other plugins?

I'm developing a plugin that creates custom wordpress pages, however I ran into a problem when trying to get shortcodes from other plugins to integrate into my plugin, well more like I couldn't find any info on it.
For example if someone uses my custom page builder and adds a short code [gallery] that is associated with an enabled plugin, I want the shortcode to do it's thing.
Could anyone point me in the right direction for this?
Try wordpress
http://wordpress.org/plugins/synved-shortcodes/
while this plugin let's you integrate shortcodes on every wordpress page , I suppose that you issue is with wordpress functions.php file where you can have a look at , with this plugin installed !
You can check if a shortcode exist before printing it with the function shortcode_exists() (https://codex.wordpress.org/Function_Reference/shortcode_exists)
Example:
<?php
if ( shortcode_exists( 'gallery' ) ) {
// The [gallery] short code exists.
}
?>
Then, if it exist and you want to print that shortcode with PHP code you should use do_shortcode() function (https://developer.wordpress.org/reference/functions/do_shortcode/)
Example:
<?php echo do_shortcode('[gallery]); ?>
Always use in WordPress's in-built
the_content
hook to print your custom page content.
WordPress by default process all shortcodes before outputting any stuff from this hook.
More info can be found here: https://codex.wordpress.org/Function_Reference/the_content

Resources