WP Sites - Brad Dalton
Forum Replies Created
-
Single event post type requiring addition of Apple and Google pay buttons.
single-event_listing
- This reply was modified 3 weeks, 4 days ago by WP Sites - Brad Dalton.
Forum: Themes and Templates
In reply to: [Twenty Twenty-Four] how to filter default nav menuThis will filter the navigation block in Twenty Twenty Four.
add_filter( 'render_block_core/navigation', 'wpsites_nav_menu_admins', 10, 2 );
function wpsites_nav_menu_admins( $block_content, $block ) {
if ( isset( $block['blockName'] ) && 'core/navigation' === $block['blockName'] ) {
if ( is_user_logged_in() && current_user_can( 'administrator' ) ) {
$custom_message = '<p class="admin-message">Welcome, Admin!</p>';
$block_content = $custom_message . $block_content;
}
}
return $block_content;
}To target a specific menu item., use code like this :
add_filter( 'render_block_core/navigation', 'wpsites_modify_specific_menu_item_for_admins', 10, 2 );
function wpsites_modify_specific_menu_item_for_admins( $block_content, $block ) {
if ( isset( $block['blockName'] ) && 'core/navigation' === $block['blockName'] ) {
if ( is_user_logged_in() && current_user_can( 'administrator' ) ) {
$dom = new DOMDocument();
@$dom->loadHTML('<?xml encoding="utf-8" ?>' . $block_content, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
$xpath = new DOMXPath($dom);
$menu_items = $xpath->query('//a');
foreach ($menu_items as $menu_item) {
if ($menu_item->textContent === 'Product') {
$menu_item->setAttribute('class', 'admin-custom-class');
// $menu_item->setAttribute('href', 'https://example.com/admin-special');
}
}
$block_content = $dom->saveHTML();
}
}
return $block_content;
}Forum: Themes and Templates
In reply to: [Twenty Twenty-Four] WordPress Gallery Shortcode Not WorkingThanks Gordon.
Thank You. The only problem is my host is running an old version of PHP and the plugin isn’t compatible.
Forum: Themes and Templates
In reply to: [Twenty Twenty-Four] WordPress Gallery Shortcode Not WorkingWorked out a temporary solution using code however still interested to know if the gallery shortcodes can be converted from classic to blocks without bulk converting posts to blocks.
Forum: Themes and Templates
In reply to: [Twenty Twenty-Four] WordPress Gallery Shortcode Not WorkingG’day Gordon. There’s hundreds i need to convert to blocks. Link
Forum: Plugins
In reply to: [Jetpack - WP Security, Backup, Speed, & Growth] Newsletter Not Sendinghttps://wordpress.org/support/users/lastsplash/ The emails where caused by the use of the WP Mail SMTP plugin with the WordPress Newsletter plugin and importation of Feedburner emails. As soon as i removed the plugins, they stopped. By the way, charging users to import emails from Feedburner into Jetpack is wrong!
Forum: Plugins
In reply to: [Yoast SEO] Gallery Images Not IndexMaybellyne. This is the code i used but i cannot see the gallery image URL’s in the sitemap
function add_gallery_images_to_sitemap( $images, $post_id ) {
// Get the post content
$post_content = get_post_field( 'post_content', $post_id );
// Look for gallery shortcodes
if ( has_shortcode( $post_content, 'gallery' ) ) {
// Extract all gallery shortcodes
preg_match_all( '/\[gallery.*ids=.(.*).\]/', $post_content, $matches );
if ( isset( $matches[1] ) ) {
foreach ( $matches[1] as $match ) {
// Get the image IDs
$image_ids = explode( ',', $match );
foreach ( $image_ids as $id ) {
$image = wp_get_attachment_image_src( $id, 'full' );
if ( $image ) {
$images[] = array(
'src' => $image[0],
'title' => get_the_title( $id ),
'alt' => get_post_meta( $id, '_wp_attachment_image_alt', true ),
);
}
}
}
}
}
return $images;
}
add_filter( 'wpseo_sitemap_urlimages', 'add_gallery_images_to_sitemap', 10, 2 );“You can also use the filter,
wpseo_sitemap_urlimages
to register images to appear on the sitemap.” I see the image URL’s in the HTML output but not in the sitemap. I’ve missed something? Not using blocks!Forum: Plugins
In reply to: [Yoast SEO] Gallery Images Not IndexThe gallery shortcode is native to WordPress and always has been used in the content area.
Shows on all my pages as well. Example. Only want it on single posts. I assume you have a filter to remove it from pages?
Forum: Plugins
In reply to: [Jetpack - WP Security, Backup, Speed, & Growth] Newsletter Not SendingLooks like i modified the date of one of them after Jetpack stopped working. Checking the REST API for some of the others is not the case. I imported FeedBurner emails into WordPress when they shutdown so maybe that explains all the returned email deliveries, not spam accounts. I didn’t know Jetpack had an import function until recently. Looks like its fixed now, not sure how but maybe because i reconnected.
Forum: Plugins
In reply to: [Jetpack - WP Security, Backup, Speed, & Growth] Newsletter Not SendingIt’s sending now however it sent 7 posts yesterday. Old posts listed here :
https://wpsites.net/wordpress-tutorials/how-to-filter-products-by-attributes-in-woocommerce/
https://wpsites.net/wordpress-tutorials/disable-shop-page-links-to-single-product-page-woocommerce/
https://wpsites.net/wordpress-tutorials/buy-2-get-1-free-woocommerce/
https://wpsites.net/free-tutorials/woocommerce-show-how-many-products-left-in-stock/
https://wpsites.net/free-tutorials/how-to-add-a-class-to-submenu-items-when-they-are-clicked/
I’m also getting a lot of these :
Delivery Status Notification (Failure) MD Mail Delivery Subsystem 8:27 AMTRASH wpsites.netAddress not foundYour message wasn't delivered to russellnasseri@yahoo.com because the address couldn't be found, or is unable to receive mail.The response from the remote server was: 554 30 Sorry, your message to russellnasseri@yahoo.com cannot be delivered. This mailbox is disabled (554.30). Reporting-MTA: dns; googlemail.com Arrival-Date: Fri, 31 May 2024 18:19:15 -0700 (PDT) X-Original-Message-ID: <CANi2xgkq0h9G4OyGEFYTsQy+jV_SquV5gAWkzaqzHVCXbn9qmg@mail.gmail.com> Final-Recipient: rfc822; russellnasseri@yahoo.com Action: failed Status: 4.4.2 Remote-MTA: dns; mta5.am0.yahoodns.net. (67.195.204.72, the server for the domain yahoo.com.) Diagnostic-Code: smtp; 554 30 Sorry, your message to russellnasseri@yahoo.com cannot be delivered. This mailbox is disabled (554.30). Last-Attempt-Date: Fri, 31 May 2024 18:27:15 -0700 (PDT) ========================= Forwarded message ========================= Subject: Your WP SITES account has been created! From: "WP SITES - Brad Dalton"<wpsites.net@gmail.com> Date: Fri, 31 May 2024 21:19:14 -0400 To: <russellnasseri@yahoo.com>
You can’t do that. You’ll need to publish a new post.
Forum: Plugins
In reply to: [Jetpack - WP Security, Backup, Speed, & Growth] Newsletter Not SendingNow i just received 3 posts which where published December 18 – 20th 2023.
Forum: Plugins
In reply to: [Jetpack - WP Security, Backup, Speed, & Growth] Newsletter Not Sending