How to make a field appear only if a post meta field has a defined value?

I would store the meta value in a variable, and use an if/elseif statement to determine what should be displayed, like so: $registrazione_singolaono = get_post_meta( $post->ID, ‘registrazione_singolaono’, true ); $registrazione_multipla = get_post_meta( $post->ID, ‘registrazione_multipla’, true ); if ( ‘singolo_file’ == $registrazione_singolaono && ! empty( $registrazione_multipla ) ) { echo $registrazione_multipla; } elseif ( ‘piu_file’ == … Read more

Parent and Child relation for custom post types

To elaborate on what Mayeenul Islam said, from the WP Docs on regsiter_post_type hierarchical (boolean) (optional) Whether the post type is hierarchical (e.g. page). Allows Parent to be specified. The ‘supports’ parameter should contain ‘page-attributes’ to show the parent select box on the editor page. Default: false Emphasis mine. After setting that to true, you … Read more

Rewrite and custom post type: order by custom field not working

If your post type slug is placement, and you set has_archive to true, then the archive WordPress generates is at /placement/. Set has_archive to placements instead and let WordPress add the rewrite rules (which will also handle pagination properly). Then, to order by your meta key, add a function hooked to pre_get_posts, check if the … Read more

Genesis filterable portfolio isotope [closed]

The archive or taxonomy code: add_filter( ‘genesis_pre_get_option_site_layout’, ‘__genesis_return_full_width_content’ ); wp_enqueue_script(‘isotope’, get_stylesheet_directory_uri() . ‘/js/jquery.isotope.min.js’, array(‘jquery’), ‘1.5.25’, true); wp_enqueue_script(‘isotope_init’, get_stylesheet_directory_uri() . ‘/js/isotope_corsi.js’, array(‘isotope’), ”, true); wp_enqueue_style(‘isotope_css’, get_stylesheet_directory_uri() . ‘/css/isotope_corsi.css’); //* Add custom body class add_filter( ‘body_class’, ‘filerable_portfolio_add_body_class’ ); //* Filterable Portfolio custom body class function filerable_portfolio_add_body_class( $classes ) { $classes[] = ‘filterable-portfolio-page’; return $classes; } remove_action( ‘genesis_loop’, … Read more