wpmnger
Forum Replies Created
-
Forum: Plugins
In reply to: [Yoast SEO] SEO fields not saving on Edit Media screenPosted a solution here: https://www.ads-software.com/support/topic/edit-media-function-to-apply-seo-doesnt-get-saved?replies=10#post-3987293
But would still like to see an update with a fix
Forum: Plugins
In reply to: [Yoast SEO] "Edit Media" function to apply SEO doesn't get savedOh yeah, and Yoast, what is your opinion on the value of adding SEO to Media Attachments?
Your plugin caters to it as it has the auto-generate SEO meta data for attachments capability (working) and the ability to manually set the SEO (broken).Would you recommend that we spend the time trying to optimize these attachments?
Hope to hear from you as we will definitely appreciate your input on this one…
Forum: Plugins
In reply to: [Yoast SEO] "Edit Media" function to apply SEO doesn't get savedInteresting… We are using the attachment post type for uploading a document repository of PDFs. Each repository has a page and that page lists all of the attached PDFs.
When viewing an attachment post, it displays the title, a long description and a list of other documents in the same repository with short descriptions. Last step is clicking download which serves the file for saving.So an attachment post type for us is practically a full page of content and not really ‘thin’.
Perhaps we are going about this the wrong way though and should re-think our approach…
Forum: Plugins
In reply to: [Yoast SEO] "Edit Media" function to apply SEO doesn't get savedSo I finally decided to tackle this one today. Here is my solution:
Looks like when hitting ‘update’ on the edit media attachment page ‘wp_insert_post’ does not fire. So the ‘save_postdata’ method in the class WPSEO_Metabox (located in wordpress-seo\admin\class-metabox.php) never gets executed.
What I have done is added a new function that is a copy of the ‘save_postdata’ and I named it ‘save_attachmentpostdata’.
I then added the filter ‘attachment_fields_to_save’ to execute it.
The only issue is that this filter catches a lot more than just the post id so we needed to change the receiving argument to ‘stuff’ and extract the post id.
The code:
add_filter('attachment_fields_to_save', array( $this, 'save_attachmentpostdata' ) );
added to the __construct function
/** * Save the WP SEO metadata for attachment posts. * * @param array $stuff * @return mixed */ function save_attachmentpostdata( $stuff ) { $post_id = $stuff['post_ID']; if ( $post_id == null ) return false; if ( wp_is_post_revision( $post_id ) ) $post_id = wp_is_post_revision( $post_id ); clean_post_cache( $post_id ); $post = get_post( $post_id ); $metaboxes = array_merge( $this->get_meta_boxes( $post->post_type ), $this->get_advanced_meta_boxes() ); $metaboxes = apply_filters( 'wpseo_save_metaboxes', $metaboxes ); foreach ( $metaboxes as $meta_box ) { if ( !isset( $meta_box['name'] ) ) continue; if ( 'checkbox' == $meta_box['type'] ) { if ( isset( $_POST['yoast_wpseo_' . $meta_box['name']] ) ) $data = 'on'; else $data = 'off'; } else if ( 'multiselect' == $meta_box['type'] ) { if ( isset( $_POST['yoast_wpseo_' . $meta_box['name']] ) ) { if ( is_array( $_POST['yoast_wpseo_' . $meta_box['name']] ) ) $data = implode( ",", $_POST['yoast_wpseo_' . $meta_box['name']] ); else $data = $_POST['yoast_wpseo_' . $meta_box['name']]; } else { continue; } } else { if ( isset( $_POST['yoast_wpseo_' . $meta_box['name']] ) ) $data = $_POST['yoast_wpseo_' . $meta_box['name']]; else continue; } wpseo_set_value( $meta_box['name'], sanitize_text_field( $data ), $post_id ); } $this->calculate_results( $post ); do_action( 'wpseo_saved_postdata' ); }
added after function save_postdata
This is obviously altering the plugin’s core files and so generally I am opposed to doing that but maybe Yoast will implement something similar as a change?
Any thoughts anyone?
Forum: Plugins
In reply to: [Yoast SEO] "Edit Media" function to apply SEO doesn't get savedAny luck bassa?
Forum: Plugins
In reply to: [Yoast SEO] "Edit Media" function to apply SEO doesn't get savedHere are a few related issues:
https://www.ads-software.com/support/topic/insert-media-yoast-seo-meta-info-wont-savehttps://www.ads-software.com/support/topic/seo-on-media-library-images
https://www.ads-software.com/support/topic/plugin-fails-to-save-data-on-attachment-pages
and mine:
https://www.ads-software.com/support/topic/seo-fields-not-saving-on-edit-media-screenWe really like this plugin and want to use it but if this bug isn’t fixed we might have to uninstall and use something else.
None of these posts have received an answer… Anyone?
Forum: Themes and Templates
In reply to: hardcode language choice in the themeyou can place it directly in header.php in between the <head> tags
OR
you can create a function in your functions.php that will add it
https://codex.www.ads-software.com/Function_Reference/wp_enqueue_styleForum: Themes and Templates
In reply to: hardcode language choice in the theme<link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/rtl.css" type="text/css" />
Sorry, typo
Forum: Themes and Templates
In reply to: hardcode language choice in the themeSorry iceq, but without knowing which theme you are using or which plugin – I really can’t help.
If you want to “hard code” you can always add a link to your rtl stylesheet:
<link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/rtl.css;>" type="text/css" />
This is assuming your stylesheet is named rtl.css and is located in your theme directory.
Forum: Themes and Templates
In reply to: hardcode language choice in the themeI want to hardcode what that plugin did
Then in header.php just type
<html <?php language_attributes(); ?> dir="rtl">
But it would be wiser to let WordPress determine these settings for you. If your language is not automatically generating the dir attribute as rtl you might want to post a question specifically for your localization team
https://ar.www.ads-software.com/I don’t know Arabic so I can’t help you any further however,
try
define('WPLANG', 'ar');
instead of
define ('WPLANG', 'ar_AR');
That is what is in the config-sample for WordPress in Arabic
Forum: Themes and Templates
In reply to: hardcode language choice in the themeWhich theme are you using and how are they generating the html?
do you have:
<html <?php language_attributes(); ?>>
in the header.php?If you just want to
hardcode that into my WordPress
Then you can edit the header.php file in the theme and just write the desired html output.
Generating the output dynamically allows for more options of course and multilingual sites.
Could you please give some more specific details…