## php – How to restrict content based on product purchase for specific woocommerce category?

I need a pay per post system for specific woocommerce products category.

Hi, my site is currently running the latest version of WordPress V5.4.1 with the woocommerce V4.0.0 plugin installed.

With woocommerce, by default the product page is accessible to all users. I would like to be able to restrict access to the product page to users who have already purchased the product. That is to say after adding it to the cart from the store and paying at checkout.

Product = a post type Woocommerce plugin link = https://fr.wordpress.org/plugins/woocommerce

So, I would like to display the content of the product page only if the product has already been purchased by the user. That is, if the product is contained in the user’s order list.

I would like to apply this system only to products of certain specific categories to be defined.

As for the restriction of products, which are not yet purchased by the user, I would also like to have the possibility of defining a redirect page whose content remains under my sole responsibility.

For this, I will expressly need a small parameter in the rediction link which would display the ID of the product to buy in this way for example: **_redirect_id=PRODUCT_ID (It will be useful for me to display on the page, some product information by the get method 😉 Like this: https://zupimages.net/up/20/22/b2wf.png

I found from my research, certain articles which deal with the subject but which always seem vague to me. Articles link:

http://www.webmasterbulletin.net/2014/01/woocommerce-restrict-content-based-product-purchase/2014

I know it shouldn’t be too complicated if you merge some of the information from the links above, but I admit that I really don’t know how to go about it, I’m worried above for days .. Thanks in advance for your help !

## plugins – Show post only for user that matches category

Disclaimer: I am not a developer. I know really a little code.

Hey!

Well, the situation is like this:

I have posts that are set to “CategoryA” for example.
In Elementor I want to show the user in his personal dashboard only the recent post that matches his Membership(using paid membership pro, membershipname=categoryname).

In the picture, in red the posts that should not be shown because the user is not matching this category.

Is there is any way to make sure that:

Posts are shown category = user role OR user membership name

Thank you!

## php – List of all posts from current category on single portfolio page

Im using the wordpress theme bridge and the portfolio with different categories. I edit the portfolio-loop to get a list of all items of the current category.

I found the following code here and tried to change it the way I need.

``````<?php

\$args = array(
'post_type'      => 'portfolio_page',
'post_status'    => 'publish',
'orderby'        => 'date',
'order'          => 'DESC',
'portfolio_category' => get_query_var( 'portfolio_category' )

);
\$my_query = new WP_Query( \$args );

if ( \$my_query->have_posts() ) {

echo '<ul>';

while ( \$my_query->have_posts() ) {
\$my_query->the_post();

echo '<li><a href="' . get_permalink( \$post -> ID ) . '">' . get_the_title() . '</a></li>';

}

echo '</ul>';

}
wp_reset_postdata();

?>
``````

But I get the complete of every portfolio from every category. The following part is not working.

``````'portfolio_category' => get_query_var( 'portfolio_category' )
``````

It works, when Im adding a certain category like this:

``````'portfolio_category' => 'category-a'
``````

Whats wrong? Thanks

## magento2 – Admin ui form category tree population issue

I’ve got an admin ui form with category tree field

``````        <field name="category" component="Magento_Catalog/js/components/new-category" sortOrder="60" formElement="select">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filterOptions" xsi:type="boolean">true</item>
<item name="multiple" xsi:type="boolean">true</item>
<item name="showCheckbox" xsi:type="boolean">true</item>
<item name="disableLabel" xsi:type="boolean">true</item>
<item name="levelsVisibility" xsi:type="number">1</item>
</item>
</argument>
<settings>
<required>false</required>
<validation>
<rule name="required-entry" xsi:type="boolean">false</rule>
</validation>
<elementTmpl>ui/grid/filters/elements/ui-select</elementTmpl>
<label translate="true">Category</label>
<dataScope>category</dataScope>
<componentType>field</componentType>
<listens>
</listens>
</settings>
<formElements>
<select>
<settings>
<options class="MagentoCatalogUiComponentProductFormCategoriesOptions"/>
</settings>
</select>
</formElements>
</field>
``````

I’ve got the field populating and data is saving correctly

The remaining issue is that the field appears blank on load

But sorts itself out when you click

I’ve missed a step. Any ideas?

## Magento2: How to remove .html from product url of category

I need to remove .html from product url
Eg:
Product url https://www.test.com/category.html/product.html to https://www.test.com/category/product.html

Thanks

## url rewriting – Looking to Have Custom Permalink For One Post Category, Removing The Base

I have custom permalinks setup with blogs/%postname%/ for the Press category I need it to just be /%postname%/

I’ve tried a few post re-writes of permalinks but I couldn’t find one that removed the base than replace. Looking to do this without a plugin.

Thank you!

## How to list all subcategories from all categories but not from a certain category

I know how to list all subcategories from a certain category, but don’t know how to list all subcategories from all categories.

For example, here is category:

``````Category 1
-Child Category1
-Child Category2
Category 2
-Child Category3
-Child Category4
Category 3
-Child Category5
-Child Category6
``````

The list i want is :

``````-Child Category1
-Child Category2
-Child Category3
-Child Category4
-Child Category5
-Child Category6
``````

This is code i have now

``````<?php wp_list_categories( array(
'orderby'=> 'id',
'order' => 'DESC',
'show_count' => false,
'use_desc_for_title' => false,
'title_li' => '',
) ); ?>
``````

## Magento 1 How to get contact Us page on Category -> Display Setting -> CMS block?

I am created CMS Static block:

And assign to category page:

if i click category page return empty page

## magento2 – How to show only Product Name and price in specific category magento 2

I am working on specific category so I need to show some customized changes in that for that I need to show only product Name and price and by clicking on that I have continued button I am confused how can I remove other details

I tried to like this in my `catalog_category_view.xml` file

``````<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="category.view.container">
<block class="testQuickShopBlockCustomOptions" name="custom.category.form"
template="test_QuickShop::quickshop/quickshop.phtml" />
</referenceContainer>
</body>
</page>
``````

but it’s not working.
Anything I am missing here?

## ct.category theory – In the category of sigma algebras, are all epimorphisms surjective?

Consider the category of abstract $$sigma$$-algebras $${mathcal B} = (0, 1, vee, wedge, bigvee_{n=1}^infty, bigwedge_{n=1}^infty, overline{cdot})$$ (Boolean algebras in which all countable joins and meets exist), with the morphisms being the $$sigma$$-complete Boolean homomorphisms (homomorphisms of Boolean algebras which preserve countable joins and meets). If a morphism $$phi: {mathcal A} to {mathcal B}$$ between two $$sigma$$-algebras is surjective, then it is certainly an epimorphism: if $$psi_1, psi_2: {mathcal B} to {mathcal C}$$ are such that $$psi_1 circ phi = psi_2 circ phi$$, then $$phi_1 = phi_2$$. But is the converse true: is every epimorphism $$phi: {mathcal A} to {mathcal B}$$ surjective?

Setting $${mathcal B}_0 := phi({mathcal A})$$, the question can be phrased as follows. If $${mathcal B}_0$$ is a proper sub-$$sigma$$-algebra of $${mathcal B}$$, does there exist two $$sigma$$-algebra homomorphisms $$phi_1, phi_2: {mathcal B} to {mathcal C}$$ into another $$sigma$$-algebra $${mathcal C}$$ that agree on $${mathcal B}_0$$ but are not identically equal on $${mathcal B}$$?

In the case that $${mathcal B}$$ is generated from $${mathcal B}_0$$ and one additional element $$E in {mathcal B} backslash {mathcal B}_0$$, then all elements of $${mathcal B}$$ are of the form $$(A wedge E) vee (B wedge overline{E})$$ for $$A, B in {mathcal B}_0$$, and I can construct such homomorphisms by hand, by setting $${mathcal C} := {mathcal B}_0/{mathcal I}$$ where $${mathcal I}$$ is the proper ideal
$${mathcal I} := { A in {mathcal B}_0: A wedge E, A wedgeoverline{E} in {mathcal B}_0 }$$
and $$phi_1, phi_2: {mathcal B} to {mathcal C}$$ are defined by setting
$$phi_1( (A wedge E) vee (B wedge overline{E}) ) := (A)$$
and
$$phi_2( (A wedge E) vee (B wedge overline{E}) ) := (B)$$
for $$A,B in {mathcal B}_0$$, where $$(A)$$ denotes the equivalence class of $$A$$ in $${mathcal C}$$, noting that $$phi_1(E) = 1 neq 0 = phi_2(E)$$. However I was not able to then obtain the general case; the usual Zorn’s lemma type arguments don’t seem to be available in the $$sigma$$-algebra setting. I also played around with using the Loomis-Sikorski theorem but was not able to get enough control on the various null ideals to settle the question. (However, Stone duality seems to settle the corresponding question for Boolean algebras.)