Hot answers tagged images
4
I am assuming that WP takes the additional parameters at the end of
the file name to automatically resize the image...
Wordpress adds those suffixes when it creates the images, which is typically done on image upload. Those images should be on the server. By default (and if I am not mistaken), WordPress does not do any dynamic image resizing on page ...
3
use add_image_size() to define you custom image size
1.register custom image size (functions.php)
if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'custom-image', 440, 265, true ); //(hard cropped)
}
2.get image in custom image size except featured image of post (functions.php)
function ravs_get_custom_image( $featured_img ){
global ...
3
In this case I would add image size in functions.php which registers new image size in my theme and get the re-sized image.
Example:
Register custom image size (functions.php)
if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'custom-image', 440, 265, true ); //(cropped)
}
Get custom image size (functions.php)
function ...
3
I would actually handle this with CSS. In your style.css file add something like this:
.page-title h1 {
text-indent: -9999px;
background: url(images/your_logo.png) 10px 10px no-repeat;
height: 100%;
}
You'll then make sure that your logo is added to your theme's images folder. Also, adjust the size of the image accordingly, or you can also ...
3
There are several parts.
You need to add an enctype to the profile form.
function edit_form_type_wpse_98375() {
echo ' enctype="multipart/form-data"';
}
add_action('user_edit_form_tag','edit_form_type_wpse_98375');
Then add a field to the form.
function user_fields_wpse_98375($profileuser) {
$_profile_photo = ...
2
I guess you are not very expirenced with PHP and files uploads. So I start with some basics and end with a simple class.
If you do not have already read the basics about file uploads with PHP, do it now. Nobody will explained it here for you, it is off topic.
Let start with the basic HTML form
if( empty( $_FILES ) ) {
global $pagenow;
$url = admin_url( ...
2
When I test get_the_post_thumbnail (also the_post_thumbnail) on WordPress 3.5.1, the alt attribute is added as it should be. If you look at the source, you will see that get_the_post_thumbnail uses wp_get_attachment_image which does add that alt attribute. By default, that attribute is the image file name but it can be edited from wp-admin->Media to be ...
2
Use get_template_directory_uri():
$url = get_template_directory_uri() . '/images/myimage.jpg';
This function will always return the correct path to your theme.
If you want to hide/shorten that URL, you could use an endpoint, maybe img. The downside is, you load the complete WordPress for each image request.
Or use mod_rewrite:
RewriteRule ...
1
There are several ways to do this:
You can add imaged directly when creating post. For example, in the "Title" box, I could put Blah blah blah.
If you want to do this for all multiple posts, it will probably get tedious to repeat this for every post. Instead, you can modify the title in the backed (in the loop) before outputting it:
<?php
$title = ...
1
It sounds like you'll need the plugins_url() function which generates the URL for the plugins directory and can handle any alternate configuration (such as if you moved it to the /mu-plugins/ directory, a personal favorite of mine). The Codex documentation is good, but here's a quick example.
Let's say you're making this in a plugin that in ...
1
Check if this works for you: Put this code in
jQuery(document).ready( function(){
function media_upload( button_class) {
var _custom_media = true,
_orig_send_attachment = wp.media.editor.send.attachment;
jQuery('body').on('click',button_class, function(e) {
var button_id ='#'+jQuery(this).attr('id');
/* console.log(button_id); ...
1
Go to http://wordpress.org/support/profile/YOUR_USERNAME/edit and set an email address that has an account on gravatar.com. On Gravatar.com, you can change the image.
Note that no other profile address will offer an email field. http://profiles.wordpress.org/YOUR_USERNAME/profile/ for example doesn’t, and there is no link to the other page.
1
The solution, needs a custom control object extending the original image control, and does an SQL query to grab the GUID and associated attachment ID on sanitisation. Not nice, kludgey, but it works
$wp_customize->add_setting( 'customimage', array(
'default' => $default,
'capability' => 'edit_theme_options',
'type' ...
Only top voted, non community-wiki answers of a minimum length are eligible
