morgyface
Forum Replies Created
-
Forum: Plugins
In reply to: [Contact Form 7] How to remove auto paragraph tags on forms onlyCan’t thank you enough @dr.mykola, I could not have worked that out, I’m sure others will be grateful too. I can confirm it works a treat!
Forum: Plugins
In reply to: [Contact Form 7] Email template data storageI’m very grateful for the response, my confusion comes from the fact that when I move databases between, local, dev, staging and production, the Mail data tab is only populated on the site where it was added. So whilst the form content exists across the board, the mail tab is empty on all sites apart from the site where the duplicated database came from, this causes any submissions to fail. This means that every time I move databases, I need to manually re-add the mail tab data. Why does this happen? Is there a workaround?
To further illustrate; The client is currently populating content on dev, when they let me know I download the database, find/replace the URL and then import to production. This works perfectly, apart from the mail tab is empty on production. It’s populated and works on dev, but is empty on production. This means that following import, I must then log-in and manually re-add all the mail tab data.
Will this be a single post object or multiple post objects?
Forum: Plugins
In reply to: [underConstruction] Warnings issued?Yup, I’m getting this also. Still seems to work but the warning appears at the top of the uC options page when saving settings.
Forum: Hacks
In reply to: Changing Names of Images Whose Filenames Contain Special CharactersHey Bongo,
I could be way off but I’ve successfully sanitized filenames before.
Have a little look at this and see if it helps:
Forum: Hacks
In reply to: Medium crop added to settings > mediaHere’s the complete solution which you’d add to functions.php:
function crop_settings_api_init() { // Add the section to media settings add_settings_section( 'crop_settings_section', 'Crop images', 'crop_settings_callback_function', 'media' ); // Add the fields to the new section add_settings_field( 'medium_crop', 'Medium size crop', 'crop_medium_callback_function', 'media', 'crop_settings_section' ); add_settings_field( 'large_crop', 'Large size crop', 'crop_large_callback_function', 'media', 'crop_settings_section' ); register_setting( 'media', 'medium_crop' ); register_setting( 'media', 'large_crop' ); } // crop_settings_api_init() add_action( 'admin_init', 'crop_settings_api_init', 1 ); // Settings section callback function function crop_settings_callback_function() { echo '<p>Choose whether to crop the medium and large size images</p>'; } // Callback function for our medium crop setting function crop_medium_callback_function() { echo '<input name="medium_crop" type="checkbox" id="medium_crop" value="1"'; $mediumcrop = get_option( "medium_crop"); if ( $mediumcrop == 1 ) { echo ' checked'; } echo '/>'; echo '<label for="medium_crop">Crop medium to exact dimensions</label>'; } // Callback function for our large crop setting function crop_large_callback_function() { echo '<input name="large_crop" type="checkbox" id="large_crop" value="1"'; $largecrop = get_option( "large_crop"); if ( $largecrop == 1 ) { echo ' checked'; } echo '/>'; echo '<label for="large_crop">Crop large to exact dimensions</label>'; }I’ve also created a gist here and will, when time permits, create a plugin.
Thanks again for your help @bcworkz!
Forum: Hacks
In reply to: Medium crop added to settings > mediaWell thanks to your nudge and ongoing support @bcworkz I’ve only gone and got it flippin’ working, I changed the add_settings_field id to medium_crop to match the existing option and field and also added an add_action priority of 1 and it retains the checked status and crops. I’ve tried checking, unchecking, and uploading images in both situations and all seems good. I’m now thinking I’ll add a large crop option and bundle it all up. I might even build my first plug-in. I shall post again shortly with the complete solution for the benefit of others.
Forum: Hacks
In reply to: The forced crop of medium sized imagesNew thread started here: https://ww.wp.xz.cn/support/topic/medium-crop-added-to-settings-media.
Forum: Hacks
In reply to: The forced crop of medium sized imagesI’m closing this thread down as it’s kinda gone off piste as it’s developed, I’ll re-word and create a new more specific question.
Forum: Hacks
In reply to: The forced crop of medium sized imagesHello again, so I’ve managed to do this:
function crop_settings_api_init() { // Add the section to media settings add_settings_section( 'crop_settings_section', 'Crop images', 'crop_settings_callback_function', 'media' ); // Add the fields to the new section add_settings_field( 'medium_cropping', 'Medium size crop', 'crop_medium_callback_function', 'media', 'crop_settings_section' ); register_setting( 'media', 'medium_cropping' ); } // crop_settings_api_init() add_action( 'admin_init', 'crop_settings_api_init' ); // Settings section callback function function crop_settings_callback_function() { echo '<p>Choose whether to also crop the medium size image</p>'; } // Callback function for our medium crop setting function crop_medium_callback_function() { echo '<input name="medium_crop" type="checkbox" id="medium_crop" value="1"' . checked( 1, get_option( 'medium_crop' )) . '/>'; echo '<label for="medium_crop">Crop medium to exact dimensions</label>'; }Visually, this looks exactly as I want it. However I now need to make it work. How do I now combine it with…
if ( get_option( "medium_crop") !== false ) { update_option("medium_crop", "1"); } else { add_option("medium_crop", "1"); }…to create the full hack?
NB. I’ve called the settings field medium_cropping, however the existing option is called medium_crop, have I done the right thing here?
Forum: Hacks
In reply to: The forced crop of medium sized imagesThanks again for your help and direction @bcworkz, because it’s not possible to be specific with the location of new fields, I’m thinking one option would be to remove the crop thumbnail option and, instead, create a new section under “Image sizes” called “Image cropping” and there have a crop option for each of the sizes. I just need to cobble it all together now.
It looks like the code is in wp-admin/options-media.php
<input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked('1', get_option('thumbnail_crop')); ?>/> <label for="thumbnail_crop"><?php _e('Crop thumbnail to exact dimensions (normally thumbnails are proportional)'); ?></label>Any idea how to remove it without fiddling with options-media.php?
Forum: Hacks
In reply to: The forced crop of medium sized imagesThanks for your help on this @bcworkz I can how what you’re proposing would work, but my ideal solution would be to add a checkbox to the settings/media page that simply updates the medium_crop option. Nice and clean.
Forum: Hacks
In reply to: The forced crop of medium sized imagesI’m getting further with this, looks like add_settings_field is the way to go. My main issue is working out how to position the new crop checkbox. I can’t see how to specify where the checkbox appears on the settings page?
Forum: Hacks
In reply to: The forced crop of medium sized imagesI’m now thinking one possible solution would be to add an additional checkbox underneath the Medium dimensions in the dashboard, replicating the layout of Thumbnail where there’s an option to “Crop thumbnail to exact dimensions”. Does anyone know how we could combine the above code with what I’m proposing here?
Forum: Hacks
In reply to: Front End Custom Taxonomy EditingAhh okay.. I misunderstood. Let’s try this:
<?php $args = array( 'taxonomy' => 'campaigns' ); $taxonomies = get_categories( $args ); if ( $taxonomies ) { echo '<select name="select" id="campaigns">'; foreach ( $taxonomies as $taxonomy ) { $name = $taxonomy->name; echo '<option value="' . $name . '">' . $name . '</option>'; } echo '</select>'; } ?>