Since you already using get_post_custom
a slightly cleaner yet still dirty (php) way of doing it.
$sermondata = get_post_custom($post->ID);
if( isset($sermondata['sermon_audio']) || isset($sermondata['sermon_video']) || isset($sermondata['sermon_document']))
{ ?>
<div id="downloads">
// rest of your echo output
</div>
<?php } ?>
ps . Just make sure the value is not null
, to be safe you can combine the check with array_key_exists()
(makes it slower though).
Related Posts:
- I’m trying to create an if statement that will only display my button link for tickets if its under ‘admission-event’… what is wrong with my code?
- Undefined $post in wp_query
- Get posts from Custom Taxonomy
- How do I create a new post upon registration with the users first and last name as title
- Removing full title and breadcrumb header container for a specific post type
- Is it possible to use array_walk() to append terms to an array of posts?
- Query entries from custom post type in an ACF flexible content field
- get_post_types() can’t get some of my post type
- Creating a non-hierarchical Taxonomy that behaves like categories
- Creating shortcode id for custom post types
- When I choose category from dropdown then everything working fine.But in backend it checked only child not parent [closed]
- Shortcode is displaying the content on top of the page [duplicate]
- get_terms() returns Trying to get property of non-object error for custom taxonomy
- Filter content in shortcode
- Query custom post types & Taxonomies and list them in a table on a page
- Custom post type and custom taxonomy 404 on page 2
- Creating a “glossary” of WordPress posts of a specific post type
- Show current user posts in custom post type query
- Using Pagination for Custom Post Type and keeps returning 404
- Custom Ratings for Theme, Proper way to Refactor Code and Clean up Template File
- Importing JSON feed giving Notice: Array to string conversion error
- How to add new post using a form to categories when categories are using as menu
- How to set the mainpage of a custom post type?
- Different post title, keywords and description
- post_content is stripping HTML when adding a new post? [closed]
- custom post type by author – wp job manager
- Querying a custom post type, but not show duplicates
- Nested Custom Taxonomies | Incorrect posts when querying
- List latest post out of 2 custom post types
- I’m trying to create a custom version of the wp_list_authors function that includes custom post types
- Validate Custom Post Type fields
- meta query not retrieving posts
- Using Wp_Query, Json to add Highcharts series data
- Template code to split a post and print a custom field?
- How do I get the index for a custom post?
- Commas not displaying in implode
- add custom tags for custom post type in wordpress
- Accessing a protected property of a post
- Different column width in 2 rows with bootstrap and custom post types-different classes needed
- How do I show my containing my custom field ONLY if there is a set value on that custom field? [closed]
- CPT Repeatable Fields + Undefined Index
- Displaying One Custom Post Type’s Content On Single Post of Another Custom Post Type
- foreach loop inside the loop creating duplicates in output
- Let users upload image(s) to the post from front end
- Foreach loop returning more than one item when querying taxonomy
- Function to erase every post from a taxonomy
- Compare Two Custom Post Types Using The Same Custom Taxonomy
- Using page title as a link to term archive
- How to display custom post type only on a certain page?
- If custom taxonomy else conditional [closed]
- Menu’s breaking, now showing all page links on site
- Creating on-page options for Custom Post Type
- Post type Echo code is repeating on homepage
- Setup page template array in a custom post type
- Sets post_parent in custom post type posts automatically based on cpt->page name
- Need help with simple “if statement” checks to output particlular CPT data depending on what client uploads/fills out
- How can I increase the post count for custom post types only?
- WordPress sitemap with Custom Post Types
- How can I sort the order of multiple custom field values in a custom post type?
- Show the categories the current post has
- Checking for custom field in admin pages
- Custom Post Type Causes Error: Warning: call_user_func_array()
- How do I call the custom Post Type name and permanent link to my php file?
- How do I ensure that post_type and Taxonomy use the same slug?
- Front end create custom post types
- Custom post type page with parameter
- Group episodes by seasons
- Is it a connection or relationship between 2 custom post types?
- pagination for custom post type archive page
- How to get post count of specific taxonomy that have store name & category
- Fetch data from two custom post types and create multidimensional array for output to html table
- Create a Dropdown Selector and Redirect for a Custom Taxonomy in WordPress?
- redirect after submiting post for review
- Change Dropdown jQuery to show/hide but with default place holder that shows all
- Create an user checklist system for a course plateform using ACF Pro and ACF Extended
- Page that lists publications by classifying them by taxonomy
- Display All Courses in Course Archive Page
- How to display “Trash” in my custom post type?
- CPT loop doesn’t seem to account for post date?
- What is the best way to set the post category (Custom Post Type) automatically based on the one of the tags assigned to the post?
- Custom fields array to display it monthly
- Custom front-end form for adding post – Category problem
- How to show the post which checkbox is not selected
- How to get the custom post data using post id in WordPress?
- Archive page for WordPress Custom Post Type doesn’t show pagination from paginate_links()
- Is it possible to get the specific content on the search page?
- set object terms after some some time of published post – functions.php
- See if the email exists or not
- php dynamic content inside shortcode
- Why is my custom post content only viewable when signed into WordPress?
- count & sum the value of custom field of the author post in dynamic posts
- I want to rewrite the URL of a specific post with a specific custom field to easily analyze in Google Analytics
- Is it possible to hide nav menu items only when they are page titles (on specific templates) but not on the dashboard?
- Get only parent post in archive post
- How to change Elementor Template for Single Page Post on Load
- On saving Post My permalink is updated and category is removed automatically which cause the 404
- update custom taxonomy custom fields
- Filter taxonomy by CPT
- Alike Shortcode using in Custom Shortcode
- Get all post under custom post type grouped by custom filed value in custom taxonomy