nitrospectide
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Inject HTML into Media Library UII have tried expanding the code the way it’s set up in that Stack Exchange example:
// Ensure the wp.media object is set, otherwise we can't do anything. if ( wp.media ) { wp.media.view.Modal.prototype.on( "ready", function() { console.log( "media modal ready" ); wp.media.view.Modal.prototype.on( "open", function() { console.log( "media modal open" ); }); }); });But none of this ever fires. So I tried something else:
wp.media.frame.on('all', function(e) { console.log(e); });(from: https://wordpress.stackexchange.com/questions/240802/list-of-available-events-for-wp-media)
But still, nothing showed in the console.
Forum: Developing with WordPress
In reply to: Inject HTML into Media Library UII replaced the contents of my custom-media-message.js file with the jQuery you provided.
I still see my message is showing on the dedicated Media Library page, so I know that part is working, but it still doesn’t show in the modal version of the Media Library that shows on a post edit screen.
- This reply was modified 8 months ago by nitrospectide.
- This reply was modified 8 months ago by nitrospectide.
Forum: Developing with WordPress
In reply to: Inject HTML into Media Library UIWhat I am currently doing is looking to see if the user is on the upload.php page, and if so, bringing in a bit of jQuery to add my markup to the page just before the targeted selector:
function custom_media_message() {
// Only enqueue the script on the Media Library page
if ( 'upload.php' === $GLOBALS['pagenow'] ) {
wp_enqueue_script(
'my-custom-media-message',
plugins_url( 'js/custom-media-message.js', __FILE__ ), // Path to your JS file
array( 'jquery', 'media-views' ), // Dependencies
'1.0.0',
true // Load in footer
);
}
}
add_action( 'admin_enqueue_scripts', 'custom_media_message' );And this is the jQuery in custom-media-message.js that’s being pulled in:
jQuery(document).ready(function($) {
$('#wp-media-grid .wp-header-end').before(
'<div style="color:#ffffff;font-size: 24px;font-weight-bold;padding:20px;background-color:#659838;margin:20px 0;">Check if media exists before uploading. <a href="/admin/media-uploading-protocol" target="_blank" style="color:#ffffff;">Get Details</a></div>'
);
});Also: I just noticed that there are 79 posts with this term applied, and it’s only 2 that are showing in the sitemap. The 2 have ‘Index’ checked in the Rank Math section of the post edit screen, while the others all appear to have ‘No Index’ checked.
My goal with this code is to override the Index/No Index setting so that admins could not let these slip through to the sitemap by forgetting to check ‘No Index.’
eos-gnss.com/success_stories-sitemap.xml
All success stories with ‘testimonials’ in the URL should be hidden, since they have the testimonials taxonomy term applied to them. Example:
/successses/testimonials/tommy-shifflett
- This reply was modified 9 months, 2 weeks ago by nitrospectide.
Forum: Plugins
In reply to: [Media Deduper] Duplicate Media Files list – single items?I selected “Hide duplicates…” in the dropdown, then clicked the Apply button, but other that a quick page reload, nothing has happened. The same total number of items still show.
Thank you. I used your code with one minor tweak to reference the post type key, instead of just ‘post’
add_filter( 'rank_math/sitemap/entry', function( $url, $type, $object ) {
// Only run for posts
if ( 'success_stories' === $type && $object instanceof WP_Post ) {
// Check if post has the term "testimonials" in taxonomy "success_types"
if ( has_term( 'testimonials', 'success_types', $object->ID ) ) {
return false; // Exclude from sitemap
}
}
return $url; // Keep others
}, 10, 3 );Then to regenerate the sitemap, it’s my understanding that I need to change the Links Per Sitemap setting and save it. But the posts I was trying to remove from my sitemap are still there.
taxonomy: success_types
term: testimonials
Forum: Developing with WordPress
In reply to: Plugin installation link not workingFirst, thank you. That fixed it.
Second, as mentioned, I am very new at this, and don’t understand why it fixed it. I see the ‘install-plugin_’ prefix listed in line 112, and that it’s being handed as a parameter to check_admin_referer(), but don’t understand what that’s doing. I see it come up elsewhere in that file, and it looks like it’s doing a check to see which action should be performed. It seems that my problem arose from example code that didn’t call this out, and made it seem like this was just a generic identifier string that only needed to be unique (presumably to act as an id somewhere).
$nonce_action = 'plugin_install_nonce'; // A unique string identifying the nonce's purposeHow does one look up functions to investigate these things?
Forum: Fixing WordPress
In reply to: Reset all passwords, no notify emailThank you!
I added your function to a custom plugin, and learned how to toggle it in the admin by adding a setting via the Settings API.
I also created a bash script to run through all of my sanitized password resets using the WP CLI approach.
Forum: Plugins
In reply to: [Permalink Manager Lite] Permalink omitting 3rd level taxonomy termAhhhhh. Thank you!
Forum: Plugins
In reply to: [Permalink Manager Lite] Permalink omitting 3rd level taxonomy termThank you. Disabling “primary category support” did it.
I don’t understand why, though. In RankMath for that CPT, I had the correct taxonomy selected as the Primary Taxonomy. It seems like it should have worked.
And then when reading your documentation, I don’t understand the difference in what is described for the two settings. It sounds like both do the same thing:
Enabled: “When the child category is selected, the slugs of all of its parent categories are included in the post URL”
Disabled: “After you disable it, the default post permalink will use the lowest available category (including its parents, if available).”These sound like they describe the same behavior.
Forum: Plugins
In reply to: [Asset CleanUp: Page Speed Booster] Clear cache from another pluginProgrammatically, I mean. A function I should call.
Forum: Plugins
In reply to: [Asset CleanUp: Page Speed Booster] Access for not AdministratorNever mind. I found the setting.
Thank you!