tanitat
Forum Replies Created
-
I encountered a very similar issue on desktop browser Chrome, Safari or Firefox, using WP 6.2.2, WooCommerce 7.9, Germanized for WooCommerce pro 3.7.2, Astra Pro 4.1.6 and WooCommerce PayPal Payments 2.2.0. Regular button #place_order is not replaced by PayPal-Buttons. By clicking the regular order button the error message is as described in the intro of this thread.
After debugging and disabling several Plugins I came down to disabling the Astra Pro Module “WooCommerce”. Without that module the PayPal-buttons are visible as expected, using WooCommerce PayPal Payments Version 2.1.0. After upgrading to Version 2.2.0 the PayPal-buttons will be displayed as well, but JS-errors “Window closed before response” and “Can not send postrobot_method. Target window is closed” are thrown by paypal’s sdk.js.
I am far from finding a solution. Playing around with the customizer options or plugin settings does not help. My workaround will be: a) switching to the built in PayPal Standard or later to a third party PayPal-Plugin, or b) disabling Astra Pro Module WooCommerce, what will lead me to rework on the product single page, the checkout and gpdr-checkboxes, and, as mentioned before, requires to keep WooCommerce PayPal Payment in V. 2.1.0.
Forum: Themes and Templates
In reply to: [Astra] Custom post template?Hey @caspervoogt , thanks for your feedback. I use my approach continuously in several projects and just double checked it using WP 5.9.3 and Astra pro 3.6.5 and 3.6.7 and it still works fine.
Using a template single-xxx.php in child theme folder is not an Astra feature but WordPress standard behaviour which seems not to be overridden by Astra. So I assume it does not depend on the specific Astra version or pro vs. free.But I generally use Gutenberg and no page builder like Elementor, so I can not tell if there might be challenges with the page builders.
In the past sometimes I struggled with naming the template correctly. In my example my custom post type is called “mycpt”, defined i.e. in a plugin with
register_post_type( ‘mycpt’, $args );
For this the template has to be named single-mycpt.php in the child theme folder. For a custom post type “my_cpt” the template is single-my_cpt.php and so on.As the single-xxx.php is easy to create, customizing the loop needs more effort, using remove_action and add_action. The solution proposed by @vyshnav4u has a approach not so far from my snippets but is differently implemented.
Apart from this I am sorry that my proposal could not help you.
In plugin version 4.1.7 I found a sample shortcode on page FAQs – Settings:
`[faq items=”-1″ cat=”Category Name” tag=”Tag name” orderby=”title” order=”ASC”]
I use the parameter cat which was formerly cat_id. Now the sample code says “Category Name”, but it works with the category slug as well.
Forum: Themes and Templates
In reply to: [Astra] Custom post template?So this is how I got along while migrating a wordpress site with several custom post types to Astra w. Gutenberg.
Finally using hooks is the way I had to go, but I did not want to mess up my functions.php with tons of HTML-markup and a bunch of logic my cpts deal with. So I put the hooks and logic into template files.I created 3 files for a cpt named “mycpt” in my child theme’s folder – you might not neeed all 3 of them:
- single-mycpt.php as a copy of single.php
- template-parts/content-mycpt.php as a copy of template-parts/content.php
- template-parts/single/single-mycpt-layout.php as a copy of template-parts/single/single-layout.php
single-mycpt.php will be used automatically for mycpt, as has been confirmed by other developers above.
Inside single-mycpt.php I add the following code to invoke the template parts (i.e. next line after get_header(); ):
/* define template for single custom post type mycpt */ remove_action( 'astra_template_parts_content', array( Astra_Loop::get_instance(), 'template_parts_post' ) ); add_action( 'astra_template_parts_content', 'content_mycpt_single_template' ); function content_mycpt_single_template() { get_template_part( 'template-parts/content', 'mycpt' ); } /* define template for content loop custom post type mycpt */ remove_action( 'astra_entry_content_single', 'astra_entry_content_single_template' ); add_action( 'astra_entry_content_single', 'astra_entry_content_single_mycpt_template' ); function astra_entry_content_single_mycpt_template() { get_template_part( 'template-parts/single/single-mycpt-layout' ); }
Now I can customize the templates, add some logic, styling, deal with different post formats etc.
If possible I stick to using hooks i.e.
<?php add_action( 'astra_entry_content_after', 'mycpt_content_bottom' ); ?>
and place this code into one of my templates. So all of my customization for a cpt can be found in the 3 template files which seems to be a tidy solution to me.This is for single view only, don’t know yet how to manage the archives.