Archived topic
Search bar customization
40 replies · Started by Sabbir on July 19, 2022
no
How did you add the Shortcode to that page ?
in child Theme Functions
(functions.php)
I tested the code from my end, and it’s not adding a <code> tag like yours does.
Most likely, as mentioned by Ying, it may be from a plugin or a custom code.
Can you try disabling all non-GP plugins again, and we’ll check from our end how it goes? If you have a staging site, you can do it there instead.
Hope to hear from you soon.
Hi,
I did it, please check it fast for me.
Thank you for testing. I can confirm that it's still there.
Since your functions.php only includes the code provided by David, by any chance, do you have any custom code added through a Hook Element?
Kindly let us know.
here are my 3 active element: https://prnt.sc/IwQr0VqcoG30
I see. There’s nothing there that should cause the issue as well.
Can you try this code instead?:
add_shortcode('cat_listing', function($html){
$categories = get_categories();
$cat_html = '<div class="my-category-term-list">';
foreach( $categories as $category ) {
$cat_html .= sprintf(
'<h3 class="term-title entry-title"><a class="term-links" href="%1$s" alt="%2$s">%3$s</a></h3>',
esc_url( get_category_link( $category->term_id ) ),
esc_attr( $category->name ),
esc_html( $category->name )
);
}
$cat_html .= '</div>';
return $cat_html;
});
Kindly let us know how it goes.
not working: https://www.disabilityresources.org/cat.html
Thank you for testing that, can you test this instead?:
add_shortcode('cat_listing', function($html){
$categories = get_categories();
$cat_html = '<div class="category-term-list">';
foreach( $categories as $category ) {
$cat_html .= sprintf(
'<h3 class="my-term-title my-entry-title"><a class="my-term-links" href="%1$s" alt="%2$s">%3$s</a></h3>',
esc_url( get_category_link( $category->term_id ) ),
esc_attr( $category->name ),
esc_html( $category->name )
);
}
$cat_html .= '</div>';
return $cat_html;
});
I’m replacing the class name one by one to see if that may resolve the issue. Sorry for the back-and-forth.
check the result here: https://www.disabilityresources.org/cat.html
In the editor - how was the shortcode added to the page ? Is it in a Shortcode Block ?
Sorry, David, I paste the shortcode normally, as I did, I hoped it will automatically get a shortcode block but it was not, I didn't notice that.
now I delete this block added a shortcode block and past the code. now, this is the result. now I just need an arrow with link.
here is the current result: https://www.disabilityresources.org/cat.html
Thats ok - its working now :)
You can use this CSS:
.category-term-list .term-title {
position: relative;
}
.category-term-list .term-title::after {
color: #777;
content: "\2192";
font-weight: 300;
font-size: 20px;
position: absolute;
top: 0;
right: 0;
}
It looks good