*

Zig220

  • **
  • 20 posts
Custom Field Display, IF THEN statement needed please
« on: October 26, 2021, 12:45:47 AM »
First, I am not a very good coder so please answer like I am a complete newbie.

I have two custom fields created in the admin for "year" and "size".
(I have specified in the admin the "Identifier names" for each of these to be the same as their field name.
i.e. The Identifier name for year is "year"  and the  Identifier name for size is "size".)
I have assigned these to only certain categories. For searches performed, sometimes both the year and size need to be shown, other times only one of them, other times none.

Hopefully to help clarify, here are some basic Logic Statements that state what I need:
If the custom field "YEAR" is assigned to a Category being viewed, display custom field "YEAR", else show nothing.
If the custom field "SIZE" is assigned to a Category being viewed, display custom field "SIZE", else show nothing.

I tried to use something like this but it does not work:
<?php if(osc_search_category_id('year')) { ?>
(html stuff goes here)
<?php } else { ?>
<?php } ?>

I hope all that made sense. Thanks for any help you can provide.
« Last Edit: October 26, 2021, 12:47:28 AM by Zig220 »

*

MB Themes

Re: Custom Field Display, IF THEN statement needed please
« Reply #1 on: October 26, 2021, 07:44:48 AM »
@Zig220
Assign custom fields to categories, theme will show custom fields based on categories.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots