Unverified

Name

add shortcode returns current category URL

Language

PHP

Rating

Voted: 0 by 0 user(s)

How to Setup Snippet

use the shortcode [get_cat_url id="42"] id as attribute for category id number you can change the default id in the snippet (default to 19)

Codevault

nsfcom

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: 6.4

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

History

Last modified:

03/09/2024

Important Note

This snippet has the following status:

Unverified

This snippet has not been verified, use with caution and at your own risk. See details provided by author in sidebar and click below to find out more.

add shortcode returns current category URL

 
                    
1// add shortcode returns categury URL
2// [get_cat_url] with id as attribute for category id number
3// [get_cat_url id="42"]
4add_shortcode('get_cat_url', function($atts){
5// set deafult category id to 19
6$atts = shortcode_atts( ['id' => '19'], $atts);
7$url = get_category_link( $atts['id'] );
8 error_log(var_export($url, true));
9 return $url;
10});

0

Related Snippets

Please see some snippets below related to this snippet..

WooCommerce

AI Verified

0

Sort order items by SKU

Added: 1 year ago

Last Updated: 1 year ago

Sort the ordered items in woocommerce order by the SKU (as opposed to the order in which the user added the product to the cart)

WooCommerce

AI Verified

0

WooCommerce Remove Checkout Button From Mini Cart

Added: 1 year ago

Last Updated: 1 year ago

This guide shows you how you can remove the checkout button from the mini cart, forcing users to view their cart before proceeding to the checkout. You may find the button still appears after implemen...

WooCommerce

AI Verified

2

WooCommerce Create Coupon Code Automatically After Purchase

Added: 1 year ago

Last Updated: 2 months ago

This snippet automatically creates a coupon code when an order is placed and lets the customer know to share said coupon code to give their friend money off. Specifically, this code creates a coupon c...

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

General

Unverified

0

create shortcode returns current page title

Added: 2 weeks ago

Last Updated: 2 weeks ago

WooCommerce

AI Verified

0

change currency symbol to AED

Added: 5 months ago

Last Updated: 5 months ago

add it to functions.php

WooCommerce

Unverified

0

add shortcode returns current category URL

Added: 2 weeks ago

Last Updated: 2 weeks ago