unwrittendevin
Forum Replies Created
-
Forum: Networking WordPress
In reply to: Unable to create posts/pages in Multi site child installsI am getting “ERR_CONNECTION_RESET” messages when I do try to access edit.php, theme.php on all of my child themes…
Forum: Plugins
In reply to: [The Events Calendar] Cannot add dateI am having the same issue with my installation of the Events Calendar
Forum: Plugins
In reply to: Limit Page Templates based on User RolesSo with some research, seeing that there is no way to really restrict the options within the Page Attributes meta box, I had to remove the Page Attributes meta box and then add it back in for the “Page” post type. From there I was able to wrap the “Template” and “Order” fields within DIVs with IDs so I could isolate them out.
My solution was modified on this page [http://wordpress.stackexchange.com/questions/90903/how-to-remove-the-template-drop-down-but-keep-parent-and-order] and also utilizing Adminimize [http://wordpress.org/plugins/adminimize/] to hide items by role and specific ID for post type.
<?php /************* CUSTOMIZE Page Attributes *******************/ function remove_post_custom_fields() { remove_meta_box( 'pageparentdiv' , 'page' , 'side' ); } add_action( 'admin_menu' , 'remove_post_custom_fields' ); function add_post_custom_fields() { add_meta_box('pageparentdiv', 'Page Attributes', 'my_page_attributes_meta_box', 'page', 'side'); } add_action( 'admin_menu' , 'add_post_custom_fields' ); function my_page_attributes_meta_box($post) { $post_type_object = get_post_type_object($post->post_type); if ( $post_type_object->hierarchical ) { $dropdown_args = array( 'post_type' => $post->post_type, 'exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('(no parent)'), 'sort_column' => 'menu_order, post_title', 'echo' => 0, ); $dropdown_args = apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args, $post ); $pages = wp_dropdown_pages( $dropdown_args ); if ( ! empty($pages) ) { ?> <p><strong><?php _e('Parent') ?></strong></p> <label class="screen-reader-text" for="parent_id"><?php _e('Parent') ?></label> <?php echo $pages; ?> <?php } // end empty pages check } // end hierarchical check. if ( 'page' == $post->post_type && 0 != count( get_page_templates() ) ) { $template = !empty($post->page_template) ? $post->page_template : false; ?> <div id="pagetemplatediv"> <p><strong><?php _e('Template') ?></strong></p> <label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label> <select name="page_template" id="page_template"> <option value='default'><?php _e('Default Template'); ?></option> <?php page_template_dropdown($template); ?> </select> <?php } ?> </div> <div id="pageorderdiv"> <p><strong><?php _e('Order') ?></strong></p> <p><label class="screen-reader-text" for="menu_order"><?php _e('Order') ?></label> <input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr($post->menu_order) ?>" /></p> </div> <p><?php if ( 'page' == $post->post_type ) _e( 'Need Help? Use the Help tab in the upper right of your screen.' ); ?></p> <?php } ?>Of course, if there is a better way to be able to remove the Template and Order fields based on user roles without having to remove the meta box from the core functionality, I am open to better suggestions!
I think this issue was cleared up when I rewrote the permalinks in the settings page (Settings/Permalinks)
I toggled from “Post Name” to “Default” then hit save, then went back to “Post Name”. Flush Rewrite will do the same thing.
Forum: Hacks
In reply to: Change the_post_thumbnail() based on screen sizeThe problem would be that it’s a slideshow of images being pulled from a custom post type called “slides”. I want to loop through each custom post type and extract the “post thumbnail” and cycle through the different images on my page. If it was a static image, I could serve the image up with different stylesheets/media queries.
How would I go about having JavaScript/jQuery tell PHP to load a different image size based on the screen width?
Forum: Fixing WordPress
In reply to: Custom Post Types, WP_Query & CategoriesMy Custom Post Type names are the same as the page slugs I am loading the pages on, so the page Illusions Vinyl Railings has a slug of “illusions-railing”, which matches the post type.
Your code worked great! I was able to use it and just add the slug variable back in to differentiate the post type for the different pages I am applying this template to.
thanks for the help!