Forum Replies Created
-
AuthorPosts
-
kevmonMember
Of course 🙂 I was making it way to complicated. Thank you Victor
kevmonMemberUpon your advice, I won't be replacing them all in the archive loop, but I would like to do it for a featured post. Does anyone know where to find the php that generates how a featured image appears in this theme, or in general?
Thanks!
kevmonMemberEven though they would be embedded videos? I guess I don't understand how that works yet. What kind of data does the browser have to download before you hit the play button?
July 28, 2016 at 6:52 pm in reply to: Add Data Attributes in WordPress, Specifically Text Widgets #190404kevmonMemberThanks!
July 28, 2016 at 2:36 am in reply to: Add Data Attributes in WordPress, Specifically Text Widgets #190361kevmonMemberThanks for the suggestion. I learned a little jQuery and added the following, also enqueuing it in functions.php.
jQuery(document).ready(function($){ $('#text-2').attr("data-wow-duration", "3s" ).attr("data-wow-delay", ".5s" ); $('.post-512>header>h4.entry-title').addClass( "wow fadeInRight" ); $('.post-512>header>h4.entry-title').attr("data-wow-delay", ".5s" ); $('.post-514>header>h4.entry-title').addClass( "wow fadeInLeft" ); $('.post-514>header>h4.entry-title').attr("data-wow-delay", ".5s" ); $('.post-605>header>h4.entry-title').addClass( "wow fadeInRight" ); $('.post-605>header>h4.entry-title').attr("data-wow-delay", ".5s" ); });
July 26, 2016 at 10:34 pm in reply to: Add Data Attributes in WordPress, Specifically Text Widgets #190271kevmonMemberPreferably the widget level because that's where I'm inputting the extra class via a widget class plugin. I plan on using this js library in more sites so it would be helpful to know how in general.
Or even better - with data-wow-duration="2s" - I would want to do something like have the value of "2s" be stored globally for that attribute in a variable so I could change the effect site-wide easily.
Thanks
July 26, 2016 at 8:52 am in reply to: Add Data Attributes in WordPress, Specifically Text Widgets #190216kevmonMemberI'm using Agent Focused Pro
July 19, 2016 at 2:20 am in reply to: Agent Focused Pro – Remove Date from Listings Custom Post Type on Archive #189777kevmonMemberThat part I don't know. The CPT is created by the AgentPress Listing plugin but I don't know PHP well enough to know how it's store or how to access it. But here's the class-listings.php in the plugin's directory.
<?php /** * This file contains the AgentPress_Listings class. */ /** * This class handles the creation of the "Listings" post type, and creates a * UI to display the Listing-specific data on the admin screens. * */ class AgentPress_Listings { public $settings_field = 'agentpress_taxonomies'; public $menu_page = 'register-taxonomies'; /** * Property details array. */ public $property_details; /** * Construct Method. */ function __construct() { $this->property_details = apply_filters( 'agentpress_property_details', array( 'col1' => array( __( 'Price:', 'agentpress-listings' ) => '_listing_price', __( 'Address:', 'agentpress-listings' ) => '_listing_address', __( 'City:', 'agentpress-listings' ) => '_listing_city', __( 'State:', 'agentpress-listings' ) => '_listing_state', __( 'ZIP:', 'agentpress-listings' ) => '_listing_zip' ), 'col2' => array( __( 'MLS #:', 'agentpress-listings' ) => '_listing_mls', __( 'Square Feet:', 'agentpress-listings' ) => '_listing_sqft', __( 'Bedrooms:', 'agentpress-listings' ) => '_listing_bedrooms', __( 'Bathrooms:', 'agentpress-listings' ) => '_listing_bathrooms', __( 'Basement:', 'agentpress-listings' ) => '_listing_basement' ) ) ); add_action( 'init', array( $this, 'create_post_type' ) ); add_filter( 'manage_edit-listing_columns', array( $this, 'columns_filter' ) ); add_action( 'manage_posts_custom_column', array( $this, 'columns_data' ) ); add_action( 'admin_menu', array( $this, 'register_meta_boxes' ), 5 ); add_action( 'save_post', array( $this, 'metabox_save' ), 1, 2 ); add_shortcode( 'property_details', array( $this, 'property_details_shortcode' ) ); add_shortcode( 'property_map', array( $this, 'property_map_shortcode' ) ); add_shortcode( 'property_video', array( $this, 'property_video_shortcode' ) ); #add_action( 'admin_head', array( $this, 'admin_style' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'admin_js' ) ); add_filter( 'search_template', array( $this, 'search_template' ) ); add_filter( 'genesis_build_crumbs', array( $this, 'breadcrumbs' ), 10, 2 ); } /** * Creates our "Listing" post type. */ function create_post_type() { $args = apply_filters( 'agentpress_listings_post_type_args', array( 'labels' => array( 'name' => __( 'Listings', 'agentpress-listings' ), 'singular_name' => __( 'Listing', 'agentpress-listings' ), 'add_new' => __( 'Add New', 'agentpress-listings' ), 'add_new_item' => __( 'Add New Listing', 'agentpress-listings' ), 'edit' => __( 'Edit', 'agentpress-listings' ), 'edit_item' => __( 'Edit Listing', 'agentpress-listings' ), 'new_item' => __( 'New Listing', 'agentpress-listings' ), 'view' => __( 'View Listing', 'agentpress-listings' ), 'view_item' => __( 'View Listing', 'agentpress-listings' ), 'search_items' => __( 'Search Listings', 'agentpress-listings' ), 'not_found' => __( 'No listings found', 'agentpress-listings' ), 'not_found_in_trash' => __( 'No listings found in Trash', 'agentpress-listings' ) ), 'public' => true, 'query_var' => true, 'menu_position' => 6, 'menu_icon' => 'dashicons-admin-home', 'has_archive' => true, 'supports' => array( 'title', 'editor', 'comments', 'thumbnail', 'genesis-seo', 'genesis-layouts', 'genesis-simple-sidebars' ), 'rewrite' => array( 'slug' => 'listings' ), ) ); register_post_type( 'listing', $args ); } function register_meta_boxes() { add_meta_box( 'listing_details_metabox', __( 'Property Details', 'agentpress-listings' ), array( &$this, 'listing_details_metabox' ), 'listing', 'normal', 'high' ); } function listing_details_metabox() { include( dirname( __FILE__ ) . '/views/listing-details-metabox.php' ); } function metabox_save( $post_id, $post ) { if ( ! isset( $_POST['agentpress_details_metabox_nonce'] ) || ! isset( $_POST['ap'] ) ) return; /** Verify the nonce */ if ( ! wp_verify_nonce( $_POST['agentpress_details_metabox_nonce'], 'agentpress_details_metabox_save' ) ) return; /** Run only on listings post type save */ if ( 'listing' != $post->post_type ) return; /** Don't try to save the data under autosave, ajax, or future post */ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) return; if ( defined( 'DOING_CRON' ) && DOING_CRON ) return; /** Check permissions */ if ( ! current_user_can( 'edit_post', $post_id ) ) return; $property_details = $_POST['ap']; /** Store the custom fields */ foreach ( (array) $property_details as $key => $value ) { /** Save/Update/Delete */ if ( $value ) { update_post_meta($post->ID, $key, $value); } else { delete_post_meta($post->ID, $key); } } //* extra check for price that can create a sortable value if ( isset( $property_details['_listing_price'] ) && ! empty( $property_details['_listing_price'] ) ) { $price_sortable = preg_replace( '/[^0-9\.]/', '', $property_details['_listing_price'] ); update_post_meta( $post_id, '_listing_price_sortable', floatval( $price_sortable ) ); } else { delete_post_meta( $post_id, '_listing_price_sortable' ); } } /** * Filter the columns in the "Listings" screen, define our own. */ function columns_filter ( $columns ) { $columns = array( 'cb' => '<input type="checkbox" />', 'listing_thumbnail' => __( 'Thumbnail', 'agentpress-listings' ), 'title' => __( 'Listing Title', 'agentpress-listings' ), 'listing_details' => __( 'Details', 'agentpress-listings' ), 'listing_features' => __( 'Features', 'agentpress-listings' ), 'listing_categories' => __( 'Categories', 'agentpress-listings' ) ); return $columns; } /** * Filter the data that shows up in the columns in the "Listings" screen, define our own. */ function columns_data( $column ) { global $post, $wp_taxonomies; switch( $column ) { case "listing_thumbnail": printf( '<p>%s</p>', genesis_get_image( array( 'size' => 'thumbnail' ) ) ); break; case "listing_details": foreach ( (array) $this->property_details['col1'] as $label => $key ) { printf( '<b>%s</b> %s<br />', esc_html( $label ), esc_html( get_post_meta($post->ID, $key, true) ) ); } foreach ( (array) $this->property_details['col2'] as $label => $key ) { printf( '<b>%s</b> %s<br />', esc_html( $label ), esc_html( get_post_meta($post->ID, $key, true) ) ); } break; case "listing_features": echo get_the_term_list( $post->ID, 'features', '', ', ', '' ); break; case "listing_categories": foreach ( (array) get_option( $this->settings_field ) as $key => $data ) { printf( '<b>%s:</b> %s<br />', esc_html( $data['labels']['singular_name'] ), get_the_term_list( $post->ID, $key, '', ', ', '' ) ); } break; } } function property_details_shortcode( $atts ) { global $post; $output = ''; $output .= '<div class="property-details">'; $output .= '<div class="property-details-col1 one-half first">'; foreach ( (array) $this->property_details['col1'] as $label => $key ) { $output .= sprintf( '<b>%s</b> %s<br />', esc_html( $label ), esc_html( get_post_meta($post->ID, $key, true) ) ); } $output .= '</div><div class="property-details-col2 one-half">'; foreach ( (array) $this->property_details['col2'] as $label => $key ) { $output .= sprintf( '<b>%s</b> %s<br />', esc_html( $label ), esc_html( get_post_meta($post->ID, $key, true) ) ); } $output .= '</div><div class="clear">'; $output .= sprintf( '<p><b>%s</b><br /> %s</p></div>', __( 'Additional Features:', 'agentpress-listings' ), get_the_term_list( $post->ID, 'features', '', ', ', '' ) ); $output .= '</div>'; return $output; } function property_map_shortcode( $atts ) { return genesis_get_custom_field( '_listing_map' ); } function property_video_shortcode( $atts ) { return genesis_get_custom_field( '_listing_video' ); } function admin_js() { wp_enqueue_script( 'accesspress-admin-js', APL_URL . 'includes/js/admin.js', array(), APL_VERSION, true ); } function search_template( $template ) { $post_type = get_query_var( 'post_type' ); if ( is_array( $post_type ) || 'listing' != $post_type ) { return $template; } $listing_template = locate_template( array( 'archive-listing.php' ), false ); return $listing_template ? $listing_template : $template; } function breadcrumbs( $crumbs, $args ) { $post_type = get_query_var( 'post_type' ); if ( is_array( $post_type ) || 'listing' != $post_type ) { return $crumbs; } array_pop( $crumbs ); $crumbs[] = __( 'Listing Search Results', 'agentpress-listings' ); return $crumbs; } }
July 19, 2016 at 2:04 am in reply to: Agent Focused Pro – Remove Date from Listings Custom Post Type on Archive #189775kevmonMemberI can't because it's only in a local development environment. However, I figured it out how to remove the date... But I haven't figured out how to add the price yet.
To remove the date (and author), I added the following to functions.php:
// Remove Post Info, Post Meta from CPT "listing" function sta_remove_post_info_listing() { if ('listing' == get_post_type()) { remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); } } add_action ( 'get_header', 'sta_remove_post_info_listing' );
But to do that I had to find where the custom post types were registered to get their names. I searched my project for "register_post_type" until I found one that looked right and substituted that name into the if statement.
-
AuthorPosts