Views is a WordPress plugin that lets you easily design the display of single pages using content templates. You can also include any field belonging to the content in your templates, without writing PHP code.
When you ask for help or report issues, make sure to tell us what you have created so far and what you want to achieve.
Viewing 15 topics - 2,671 through 2,685 (of 2,685 total)
Problem: My Content Template is not being displayed on my site. I have a Content Template assigned to my custom post type, and I also have a custom PHP template in my theme following standard WordPress Template hierarchy (single-slug.php).
Solution: Resave your site's Permalinks and try again.
Problem:
I created a post type called "Stores" that displays store info and a Google map for each store. I created a second post type called "Upcoming Events" that shows event information and date of each event. I would like to display Upcoming Events for each store based on the value of a field (Store Number) from the Store post type. The store number is part of the information entered for each store, it is not the post ID. I would like to be able to create an Upcoming Event and enter a comma separated list of Store Numbers in order to display the event on one or more store pages.
Solution:
In your case, one "Upcoming Event" post can connect to multiple "Stores" posts, and one "Stores" post can connect to multiple "Upcoming Event" posts, that is many-to-many relationship,
I suggest you follow our document to setup many-to-many relationship between post type "Upcoming Event" and "Stores", within many-to-many relationship, it is not required to re-entering the same Upcoming Event info for each store location.
Problem:
Get the ID of a youtube video and display it with a shortcode inside of a content template and store it in a another custom post field created with types to turn the ID into a shortcode then display on the page.
Solution:
You can do it using cred_save_data hook something like below:
add_action('cred_save_data', 'my_save_data_action',10,2);
function my_save_data_action($post_id, $form_data)
{
// if a specific form
if ($form_data['id']==12)
{
if (isset($_POST['my_custom_video_field']))
{
$link = $_POST['my_custom_video_field'];
$video_id = explode("?v=", $link); // For videos like <em><u>hidden link</u></em>...
if (empty($video_id[1]))
$video_id = explode("/v/", $link); // For videos like <em><u>hidden link</u></em>..
$video_id = explode("&", $video_id[1]); // Deleting any other params
$video_id = $video_id[0]; // here is your required video ID
// add it to saved post meta
add_post_meta($post_id, '__my_custom_video_field', $video_id, true);
}
}
}
==> Please replace '12' to your CRED form ID in the above code.
==> Replace 'my_custom_video_field' to your field slug
==> Replace '__my_custom_video_field' to your field slug where we need to save youtube ID.