Undo Removed Featured Images from database wordpress - php

I was editing my WordPress theme and editing function.php
I used a code for not loading featured image file. but it seems the code removed the ability of loading featured image from database
i found the topic here and used it:
http://spicemailer.com/wordpress/how-to-remove-featured-image-from-all-posts-wordpress/
how can i Undo it?
It seems it has removed the link of my database to featured image,
now there is no featured image in edit pages/posts of wordpress
all my websites images which were features images are not displaying
my website is : http://www.aryagostarafzar.com
please help me how to undo and set the link againg
my last backup is for a week ago and i will lose many things

I had a look at the article. Unfortunately there is no reverse code for this situation as the query has deleted the records in the database.
If you had taken a backup of your database before running this query, you can restore it.
Otherwise, as mentioned in the articles your images are still available in the media library. So, you have to edit each post again and set the featured image on individual posts.

Related

Website Images - Loss of quality

The images on my web page seem to "lose" quality / color in thumbnail sizing.
Link To Site
I have tried to insert the following to prevent Wordpress from compression the images - I then regenerated thumbnails, howver problem still exists.
The images display correctly upon opening - the error is with the thumbnails
add_filter('jpeg_quality', function($arg){return 100;});
I have also tried setting the plugin "imsanity" quality to 100 - and also tried deactiving the plugin and reuploading new files. So I am doubtful this is the problem.
I am using DIVI theme. have tried DIVI support who believe the problem is not with the theme.
any advice please? Thank you

Remove the featured image from the top of each post

I am trying to remove the featured image from the top of each post. I am using the Pure theme from gt3 themes. The featured image shows up at the top and shoves all the other content to the far right.
I have tried installing the remove featured image plugin, while the tickbox shows up clicking it has no effect. I have also tried editing the page.php and single.php pages within the theme as suggested by several other posts. But the lines they call to be removed are not present in my code (or at least I have not located them). The only code I am seeing (inside singel.php) related to the featured image/thumbnail is:
$featured_image =
wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'single-post-thumbnail');
I have tried removing this with no effect. I have also tried adding something like this to the css
.featured_image_standalone {
display:none;
}
Also no effect. I have a few clients that use the Avada plugin and I have managed to disable the 1st featured image with no problem but I am hoping for a free alternative to purchasing this plugin.
Alternatively, I would be satisfied if I can add additional images below the featured image, leaving the copy to the right. Like on this demo page.
Any help is greatly appreciated! I am a beginner but have been editing/managing WP sites for clients for several months now so I've gotten my hands dirty and with a little instruction I am sure I can remedy this issue.
Thanks!
PS. I tried adding links where appropriate but it appears I can only add 2 in the forum so please ask for clarification and I will post.
It's possible that you're viewing the pages that use template other than page.php.
I'd do the changes to the other template files (in the theme root directory). Also the templates that are dedicated for posts instead of pages.
Commenting that line might lead to an error of calling an undefined variable and/or assign an alternative default value if it isn't defined. So I'd initially experiment with a specific hardcoded thumbnail id like this:
$featured_image =
wp_get_attachment_image_src(
get_post_thumbnail_id( 123 ),
'single-post-thumbnail'
);
'123' being the test id that you're using.
In some environments when PHP gets a fatal error, the server continues to serve the last executable version of the files, hence you might be not witnessing the change because of the fatal error.
Edit
Based on the image that lists the files of the theme provided in the comments, I'd copy the following files, one at a time, to the child theme directory and modify the code there:
page.php
page-contacts.php
single.php
single-team.php
single-gallery.php
image.php
category.php
bloglisting.php
attachment.php
The previous list is ordered by likeliness of the file to be the one you'd want to update, so I'd try one at a time and see the results. Also you'll need to copy these files to the child theme because any modifications to the original files under the parent theme can be erased upon theme upgrade.
To find post ID you can check wp_posts table in phpMyAdmin, if that's not accessible, before anything you can do echo 'post_ID: ' . get_the_ID(); in one of the template files and visit a particular page to see the echo'd ID. Also I think there are some plugins that display the post ID's at the post table withing the admin dashboard UI.
In order to see whether the server serve the last executable files upon fatal error, you can make an echo statement and with every code change to see if the echo get printed.

Wordpress change image link to attachment page on old posts - bulk change

Is there a way to change all old posts images links?
I have this blog, that have more than 2.000 posts and each post with at least 10 images. All the images are linked to file. Now I created an attachment page template for the images. The new posts are working well with default images linking to the attachment page.
But I would like to know if is it possible to bulk replace all image links from older posts (that are linking to file) to the attachment page without opening each post and edit each image.
I searched on the web and couldn't find anything about replace the image link on old posts, I found only things about change the default image links on new posts created, which is working fine already on my blog.
Thanks in advance,

Wordpress set featured image pagination is required, bcz all the images are loading at a time which taking lot of time

Currently I am using wordpress 3.9 version, In admin panel when I click on the 'set featured Image' while posting a new post. Then it showing media library photos, the problem is there is not pagination for the images so that all the images are loading at a time.... which is taking lot of time.... and I have more than 1000 images in my media.
I found the pagination is available for older version of wordpress admin panel..... can some 1 check the issue suggest me plugins or any code editing in wordpress admin.
Thank You, In advance.

Change in media library doesn't affect published articles

I'm running a WordPress blog with a lot of published articles and a lot of pictures in the media library. My question is:
Is there a way(plugin?) to make WordPress apply changes I made in the media library(e.g. changing the description/alt text of a picture) to already published articles containing that picture?
Each time a media is used by Wordpress on a template, its proper data (excerpt, etc.) sould be loaded.
Try to clean your cache to force Wordpress to reload the data.
Maybe the theme you use on your blog don't use the right fields to populate the alt text of the pictures. Semantically, it should be 'image_alt' and 'post_description'.

Categories