How to change this code for src - wordpress

My logo doesn't show in staging because there's no http://. I'm trying inspec to add http:// so my logo can show.
That's why I must change code but I got confused on where I must edit code in folder WordPress even the code is customized from theme. How to edit src image in WordPress?
if ('disable' != $corporate_plus_customizer_all_values['corporate-plus-header-id-display-opt']):
if ('logo-only' == $corporate_plus_header_alt['corporate-plus-header-logo']):
//corporate-plus-header-id-display-opt
if ('') :
//function_exists('the_custom_logo')
//the_custom_logo();
else :
if (!empty($corporate_plus_customizer_all_values['corporate-plus-header-logo'])):
$corporate_plus_header_alt = get_bloginfo('name');
?>
<a class="navbar-brand animated" href="<?php echo esc_url(home_url('/')); ?>" title="<?php echo esc_attr(get_bloginfo('name', 'display')); ?>" rel="home">
<img src="" alt="<?php echo esc_attr($corporate_plus_header_alt); ?>"
</a>
I edited like this but nothing happend. Anyone can help?

Related

Wordpress Header Image not showing alt text

my theme is showing the alt text for the main header image as alt="". Even though I have added this in the media library etc.
I have found the PHP code in the header.PHP file as below. What do I need to change to manually put the alt text in?
<img class="logo" src="<?php echo esc_url(($site_logo)); ?>" alt="<?php bloginfo('sitename'); ?>" />
Thanks
You can't use sitename in <?php bloginfo('sitename'); ?> for example you can use <?php bloginfo( 'name' ); ?>
Below values what you can use.
https://developer.wordpress.org/reference/functions/bloginfo/#possible-values-for-show

How to display logo in Drupal?

I am just learning Drupal and I am having trouble to display a logo on my custom theme..
page.tpl.php:
<a href="<?php print $front_page;?>">
<img src="/<?php print $directory;?>/img/logo.png" alt="<?php print $site_name;?>" height="80"
width="150" />
</a>
As I look inspecter, I see that the path is correct:
<img src="/themes/bony/img/logo.png" alt="Haldun Atar Drupal Page" height="80" width="150">
On Appearance > Settings panel I also entered the path: themes/bony/img/logo.png
I just can't display the logo.. Where do I search the problem?
P.s: I have the logo img in img file.
Thank you in advance!
If you uploaded the file on the theme settings page, you should have a $logo variable in the page.tpl.php (though this will depend on if you have overridden the preprocess).
You can see how it is output if you look in the 'modules/system/page.tpl.php'.
In the system page.tpl.php it is output like this:
<?php if ($logo): ?>
<a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home" id="logo">
<img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />
</a>
<?php endif; ?>
If you click on the src link in inspector does it take you to the image? If not try an absolute path like /<absolute>/<path>/<to>/<your>/<folder>.
Did you clear cache after you made the changes?
Admin -> configuration -> performance -> clear cache

Wordpress Arcade theme modification

I'm self learning Wordpress and trying to modify Arcade basic theme.
What I need is to remove the ARCADE title and replace with an image. also I'm trying to get two call to action buttons instead one.
Can someone help me with a solution. I got a fair understanding about PHP however I seems to cant locate any file to think of a modification too.
Thank you
You need to modify your header.php file under the theme folder.
Open wp-content-> themes -> arcade-basic -> header.php
Put the following code under the
<div id="site-meta">
<h1 id="site-title">
<img src="<URL to your LOGO>" /> </h1>
<?php if ( $bavotasan_theme_options[ 'header_icon'] ) { ?>
<i class="fa <?php echo $bavotasan_theme_options['header_icon']; ?>"></i>
<?php } else { $space_class=' class="margin-top"' ; } ?>
<h2 id="site-description" <?php echo $space_class; ?>>
<?php bloginfo( 'description' ); ?>
</h2>
<a href="#" id="more-site" class="btn btn-default btn-lg">
<?php _e( 'Button1', 'arcade' ); ?>
</a>
<a href="#" id="more-site" class="btn btn-default btn-lg">
<?php _e( 'Button2', 'arcade' ); ?>
</a>
</div>
Let us know if you have any queries.
You can Change it Two Way.
1.) You Add Code On Direct Header.php Files.
<div id="site-meta">
<h1 id="site-title">
<a href="<?php echo esc_url( home_url() ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
<img src="<URL to your LOGO>" />
</a>
</h1>
This Code Is Dynamic Code It's Come From Admin Panel.And You Also Add Static Site Name Like
<div id="site-meta">
<h1 id="site-title">
<a href="<?php echo esc_url( home_url() ); ?>" title="SITE NAME" rel="home"><img src="<URL to your LOGO>" />
</a>
</h1>
And Second Is.
2). Go Admin Panel -->> Appearance -->> Customize
3). you can create your own header.php file as per your requirement.
Now You See Theme Setting Page Write Your SITE NAME on Site Title & Tagline.

display post_thumbnail with older thumbs alternative

I'm trying to add post_thumbnail support to an old wordpress theme that used to have a custom field for displaying thumbnail images. Trying to combine it as below, so older thumbnails won't get lost.
<?php
//display new featured image thumb
if (has_post_thumbnail()) {
the_post_thumbnail(homethumb);
}
//use the old thumb if there is no new one
$customField = get_post_custom_values("post-thumb");
elseif (isset($customField[0])) { ?>
<img src="<?php get_custom_field('post-thumb',true); ?>" class="avatar" alt="<?php the_title(); ?>" />
<?php
//or use default thumbnail if there is no thumb at all
} else { ?><img src="<?php echo get_option('theme_post_blankthumb',true); ?>" class="avatar" alt="<?php the_title(); ?>" /><?php }?>
which gives *Parse error: syntax error, unexpected T_ELSEIF*
If you use logical and organized code indentation, you're gonna see clearly where the problem is:
<?php
//display new featured image thumb
if (has_post_thumbnail()) {
the_post_thumbnail(homethumb);
}
//use the old thumb if there is no new one
$customField = get_post_custom_values("post-thumb");
elseif (isset($customField[0])) {
?>
<img src="<?php get_custom_field('post-thumb',true); ?>" class="avatar" alt="<?php the_title(); ?>" />
<?php
//or use default thumbnail if there is no thumb at all
} else {
?>
<img src="<?php echo get_option('theme_post_blankthumb',true); ?>" class="avatar" alt="<?php the_title(); ?>" />
<?php
}
The line $customField = get_post_custom_values("post-thumb"); doesn't belong there. Put it before the if/elseif/else.
The PHP Manual is your friend. And using a good ide will make your life easier.

Advanced Custom Fields - Fancybox Slideshow on Clicking a Thumbnail

I'm trying to create a fancybox slideshow that pops up when you click on one thumbnail. I'm using Advanced Custom Fields with Gallery Field.
This is what I have;
<?php
$images = get_field('gallery');
$image_1 = $images[0];
?>
<a href="<?php echo $images['url']; ?>" rel="fancybox">
<img src="<?php echo $image_1['url']; ?>" /></a>
Unfortunately, nothing happens when you click on the imageā€¦
Any leads?
Thanks!
As Pranita said you should be using a for loop for generating the gallery.
If this display more thumbnails than you want, you can simply build your HTML/CSS so that every thumbnail, except the first, is hidden.
Use this, from the official documentation, and customize it to your needs.
<?php $images = get_field('gallery');
if( $images ) : ?>
<div id="carousel" class="flexslider">
<ul class="slides">
<?php foreach( $images as $image ): ?>
<li>
<img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" />
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
The problem is you have used $images['url'] where images is a multidimensional array. It has to be $image_1['url'];
Simply use for loop if you want every image. Else if you want only one image then use
<a href="<?php echo $images[0]['url']; ?>" rel="fancybox">
<img src="<?php echo $images[0]['url']; ?>" /></a>

Resources