Remove the featured image from the top of each post - php

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.

Related

X-cart css and categories image is not changing

I was working on one of the client's site, using x-cart 4.7 version, the template is Reboot. I change their CSS file, but the site style is not changing.
I tried couple method, but still not changing, here's what I tried:
Rename the var/template_c to regenerate the cache. (<- template support suggest)
Uncheck Do not check if templates are changed, it's already unchecked.
I can't use http://www.yoursite.com/xcart/cleanup.php to clear cache. No folder and path found.
I was thinking should use X-cart admin/template-name/template-clean up/ Clear templates/X-Cart cache
Will this method delete a lot of things? Because can't back up the site and database, and I not really familiar with this platform.
Question2: Trying to change categories default image, I changed the setting/Images location/categories-icon(or Banner System images
)it's not changing anything, but Product thumbnails/image is working.
I even change the file name in FTP still working, so I so confused where those image pulling from.
Thank you for all the help.
Q1: Try locating which CSS file is loading on the page. Use web-dev-console for that or just view the page's source code. Temporarily untick the 'Use speed-up tool for CSS' checkbox on the 'Main page :: General settings :: General' before that.
Q2: There are 2 types of category images.
http://demo.x-cart.com/demo_goldplus/Computer-hardware/
1. Temporarily disable the 'Flyout Menus' module to localize the problem with category's menu icon.
2. The same solution as for Q1. Find out which path is used for the category image in the source code.

order posts on one category by order

I already searched for solutions but have no idea where to put PHP code found on this site. No one shows how to edit CSS for the years list. I want to make a certain category to show all posts in gallery mode (grid) and to make it yearly filtered exactly like this one:
items in grid. Please excuse me but I really don't know how to explain it better than showing this example and I really don't want to make an ad or a link to this website. I have not found any other way.
Such things are usually accomplished by the use of an archieves.php file in the root of your wordpress theme directory.
So I would suggest just find this file and edit it to your needs: Edit the code to display it as a grid.
You can add your CSS inline but I would not recommend that. Just place your CSS inside one of the files that come with your theme. Mostly they are placed inside your themes directory in a folder called 'styles' or 'css'. Often theres a file especially for custom user styles. Of course you also can create your own one and reference it inside header.php or even import it in one central CSS file.
Here is a little link (did not look into it but maybe thats useful since you already have the CSS code to display items as grid):
Display all wp-posts

How do I insert a field to display above the Content field in WordPress Posts?

I need WordPress Posts to pull a database entity they are not normally supposed to and display the field above the Content output.
Details:
Videos are being uploaded to Vimeo via plugin, which is throwing the iframe code into the database in a convenient and ordered way.
Posts need to display these videos followed by some simple text content.
The Post needs to pull this particular db entry (the iframe) and display it directly above the Content area.
If you could point me to a plugin which manages this, awesome. Otherwise, I'm not sure how to handle this except to change the default method WordPress displays its Posts. While that's not terrible, it's not ideal, as I presume each update would wipe the changes.
This was my question, and I solved it years ago. I am answering it for closure.
Modified PHP files can be preserved by cloning them into the Child Theme.
Copy over WP's single.php to the correct location in your Child Theme (there is copious documentation and a bit of nuance to this process). WP's PHP files are matryoshka dolls, so you may end up copying over a dozen files for one page type.
Read through the files and clone or modify what you need to deliver your final result.
How to pull from the database: Link1 and Link2 will help
Profit

How to create a thumbnails page in WordPress

I'm creating a WordPress photoblog theme and I want to create a thumbnails page that sits between index.php and single.php.
The idea is that when someone clicks on a blog post, they go to the thumbnails page to see all photos attached to that post and they then click on an individual image to be redirected to the blog entry. Does WP templating support this?
WordPress just loads the files inside of the theme's directory, so you aren't limited by WP much.
If you want, why not just make the index.php file have a section which runs only when it receives a $_GET variable denoting that the user has requested the thumbnails page?
This is sort of what I mean:
single.php:
<?php
if (isset($_GET['gallery']))
{
// Show the gallery.
} else {
// Show the main content instead
}
?>
And on index.php, you could add the gallery parameter to the URLs:
Title of Article
But that's just the way I'd do it.
I don't see what you mean by "the user clicks on a blog post", but in short, you could modify the main template to write a link like:
Show Photos
Then write some custom plugin to manage a set of photos per blog post.
Finally, create a page "showphotos" and assign it to a theme file and add the necessary PHP code to generate the thumbnails inside of it.
The problem with your question is that you're asking something similar to "how do I build a wooden tower"? There are different ways, and each depend on different use cases, none of which are specifically tackled by your question. Don't forget that we on SO are not here to create plugins for you, so don't ask for elaborate systems and instead focus on what's bugging you.

WordPress: don't show 404 when no posts exist

Currently there is a bug in WordPress if you have a Posts Page set under:
Settings->Reading->A Static Page->Posts Page
If there are posts, than the page (e.g. with a slug called news) displays the post, and uses index.php from the theme.
But, with this configuration, if there are no posts, then it calls the theme's 404 page. This is definitely a bug, and has been submitted (Ticket #10822). It should be letting index.php show whatever it wants upon !have_posts(), but right now the page doesn't seem to be called at all.
My question is: is there a workaround for this bug without modifying core wp files? I'd be open to a plugin, theme changes, a custom page template, htaccess changes, etc.
I just performed a test for it. It isn't actually serving a 404, it's using index.php but since no posts are found so it falls outside of the have_posts(). Are you sure it's not a plugin or theme causing your issue? I tested this with the default theme on a base install of WordPress.
Most theme files have as part of their WP loop a catch for no posts, i.e.:
<?php else : ?>
Sorry, but you are looking for something that isn't here.
<?php endif; ?>
That might be what you're seeing. You can use a custom page template without that text (leave the loop) for yoiur posts page. And try Reveal Template | coffee2code.com to find out what template file you're looking at.

Categories