remove and disable featured image in posts - wordpress

I write a post in new post editor and then add media. I can see the images in the editor but when i publish them they aren't loading up and a frame with little square in the middle comes up. This is the link to one of my posts: http://getprogramcode.com/2013/03/c-program-for-bit-stuffing/ . For some people only link to the image comes up and it opens up with 404 error. See the line after OUTPUT: bit stuffing.
Also i want to remove the featured image from appearing in my posts. I have a option in my theme on a new post: "disable featured image" - but that doesnt work . Also if i dont put the image or i remove the featured image the empty image appears: see the home page: http://getprogramcode.com Please help me to solve this problem

You should not use relative paths on WordPress, only Absolute paths.
The problem is that you are using ../wp-content/... as your URL's for image paths.
When adding images, you should have the option to give it a path, you should opt to link to the media file.
For the disable feature image, if you go into the page.php or single.php code, it should have a line of code in it for calling in the featured image.
It should look something like this:
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
?>
You just need to remove or comment out this code and it should stop showing up on the pages.

Related

Why is a line break (<br />) being added to my image URL?

My website is built on WordPress and using the theme Divi. I am writing a new post and using the Divi image module to add images. In the editor the image shows up fine, however when the post is previewed or published, the image doesn't show up. Upon inspection, the URL for the image has a <br /> in it which is breaking the link to the image.
Any idea why this is happening? Thanks in advance.
Are you putting your image directly with the text editor or a you writing your text separatly ? With divi's page builder you can add an image to a block or widget, and write the text inside separatly.
I also have the same issue - Divi image module - generates a wrong path of image src.
I also have no solution, but I built a work around until the cause is found and have concrete solution.
function change_url_the_content($content){
$content = preg_replace("/br\%20\//", "", $content );
return $content;
}
add_filter("the_content", 'change_url_the_content', 9999999);

Wordpress - TwenteenSeventeen picture instead of a title

I'm really new in coding, especially in css. I already read some tutorials but I like to change a specific thing. For my Website I use Wordpress. I also edited a few things in my CSS which already worked. Now I can't find a answer for how I can replace the title with a custom picture.
Click here to watch a picture to understand what I mean.
Click here to acess my website.
I already tried some things, but it would be nice if someone can explain me how to do it.
You can edit header.php in the twenty seventeen to display only a picture.
This source code is on your wordpress server in wp-content/themes/twenty-seventeen/header.php: https://github.com/WordPress/twentyseventeen/blob/master/header.php
You'll want to replace line 31:
<?php get_template_part( 'components/header/header', 'image' ); ?>
With something like
<img src="banner.png" />
You'll have to adjust the location of banner.png to where you actually upload the image.
After you've got that working and it's basically what you want, you can wrap the image tag in a a tag so the banner links back to your home page, if you'd like.

The URL added while adding featured image in wordpress

I am working with wordpress latest version.
As in wordrpess, we can add URL while adding a featured image in a post as there are text fields like caption, title, alt text, description, URL etc.
I've added a link like http://example.com/abc-news
I am fine to show the featured image in the blog post but I want that link as
{featured-image}
So that, if anyone clicks on the featured image he/she will go to that link.
Any help would be appreciated.
If you are using the default theme with the latest version of WordPress, you can edit content.php in the 2014 theme directory.
You need to wrap <?php twentyfourteen_post_thumbnail(); ?> with the link code pointing to your URL.
This code should be around line 13 in content.php.
<?php twentyfourteen_post_thumbnail(); ?>
To link to the current blog post, you could add this code:
<?php twentyfourteen_post_thumbnail(); ?>
If you are using a different theme than the default, open the file which contains The Loop in your theme, search for the_post_thumbnail or a similarly named function, and change the code as above.
The exact answer will vary depending on theme, but 98% of the time the fix should be similar to the above. Hope this helps.
Edit: Here's some more information: http://codex.wordpress.org/Function_Reference/the_post_thumbnail#Post_Thumbnail_Linking_to_the_Post_Permalink
Thanks for your prompt reply.
You are right that it's 98% depending on the theme.
The theme is using a meta_value to add a custom URL for the featured image.
So, I need to get that URL through get_post_meta
I've got from here.
And I am fine with it now. :-)
Thanks

Setting thumbnail featured image size not working properly

Hi I just started today on creating my first Wordpress Theme and I am trying to create a featured Image for each post.Aldo I have managed to acomplish that it seems that the sizes I am giving it are not taking effect.Here is my code:
if(function_exists('add_theme_support')){
add_theme_support('post-thumbnails' , array('post'));
set_post_thumbnail_size(200,120);
}
if(function_exists('has_post_thumbnail') && has_post_thumbnail()){
the_post_thumbnail();
}
It seems that my featured images are not always set to the same size.For example if the image is smaller then what size I set it will remain the same , for big images the width is the same but for some the height is different.
What am I doing wrong here?
Are you setting the thumbnail size in functions.php? It will not work properly if it's just in index.php or another theme file.
From the codex:
This feature must be called before the init hook is fired. That means
it needs to be placed directly into functions.php or within a function
attached to the 'after_setup_theme' hook. For custom post types, you
can also add post thumbnails using the register_post_type function as
well.
the_post_thumbnail() displays the thumbnail and should be placed where you want the thumbnail to display.

How to change default post attributes?

My site needs to have image based posts, meaning the post is only an image.
Now i tried implementing it with Custom Post Types, but have encoutred problems,
like categories didn't show the right posts, pagination caused problems etc.
Now i thought to myself that i don't need the regular posts and if i could just edit them
to have only the featured image option enabled, life would be much easier.
But i failed to find any information regarding this.
Anyone can help me please?
To add featured image support/option simply add the following code snippet to your functions.php file located inside your theme's root folder
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
}
and to show the featured image inside your template you can do
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail(); // will show the featured image if you have set any for the post
}
Applicable to Wordpress version-2.9 and higher.
When you add new post just find the featured image meta box and set an featured image from there.
You can also setup image sizes (depending on that images will be displayed) at the front end, just take a look at here.

Resources