Display Admin Column from Related Parent Post Title
Started by: simchaH
in: Toolset Professional Support
Quick solution available
Problem:
The issue here is that the user wanted to display their parent post information in the Toolset Admin Column for the custom post type.
Solution:
This can be done by using the code below.
//Replace the following
/*
cptslug - replace with custom post type slug
parent - replace with parent cpt slug
child - replace with child cpt slug
Column Name - replace with the desired column name.
*/
//Add custom column
add_filter('manage_edit-cptslug_columns', 'my_columns_head');
function my_columns_head($defaults) {
$defaults['Parent'] = 'Column Name';//edit
return $defaults;
}
//Add rows data
add_action( 'manage_cptslug_posts_custom_column' , 'my_custom_column', 10, 2 );
function my_custom_column($column, $post_id ){
switch ( $column ) {
case 'Parent':
$parent_id = toolset_get_related_post( $post_id, array( 'parent', 'child' ) );//edit
if($parent_id){
echo get_the_title( $parent_id );
} else {
echo 'No Parent Found';
}
break;
}
}
This code can be added to your Toolset custom code settings at Toolset -> Settings -> Custom code and then activate it once you've added the code.
2
7
4 years, 9 months ago
simchaH
Looking for the shortcode of a custom taxonomy
Started by: perryv-2
in: Toolset Professional Support
Quick solution available
Problem:
The user asks on how to display a post's taxonomy terms using shortcodes.
Solution:
You can use the wpv-post-taxonomy shortcode like this:
[wpv-post-taxonomy type="platform" separator=", " format="link" show="name" order="asc"]
This will produce links to the terms' archives, separated by a comma(,).
You can also iterate through the array of terms with the wpv-post-taxonomy-iterator and produce the markup that you need with the wpv-taxonomy-* shortcodes:
<ul>
[wpv-post-taxonomy-iterator taxonomy="platform"]
<li><a href="[wpv-taxonomy-link]">[wpv-taxonomy-title]</a></li>
[/wpv-post-taxonomy-iterator]
</ul>
Relevant Documentation:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-153472
2
3
4 years, 9 months ago
perryv-2
Remove previous / next link
Started by: ilonaB-2
in: Toolset Professional Support
Quick solution available
2
5
4 years, 9 months ago
ilonaB-2
Always show empty options in a filter
Started by: marioD-5
in: Toolset Professional Support
Quick solution available
Problem:
The issue here is that the customer wants to always show values that will produce a No Results Found on their view filters rather than having only values that will produce a result.
Solution:
On your view you should be able to see the custom search settings section.
When you choose the setting "Let me choose individual settings manually", under "Which options to display in the form inputs" choose "Always show all values for inputs"
2
5
4 years, 9 months ago
marioD-5