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
Related
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?
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
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.
Ok, I'm going crazy over the_permalink() function. This is not going to be easy to explain the issue, but I will try. When I'm on the index page of my website(index.php), and when I click on a link that's in the footer section, it will take me to the recent post (single.php), and that is fine. However, when I start off on the index page(index.php), and when I use the navigation bar to navigate to a certain page(page.php)(which has the same layout as the index.php), and then, when I click the same link that's in the footer section it should take me to the recent post (single.php), but it is not. It's taking me to the current page(page.php) instead of single.php. Here is a snippet of my code:
The footer:
<div id="clear"></div>
<div id="video">
<!--<img src="<?php bloginfo('template_url'); ?>/images/video_03.png" alt="Video" border="0" width="263" height="193" title="Video" />-->
<iframe width="263" height="208" src="http://www.youtube.com/embed/WYc4ZOxRX-4?rel=0" frameborder="0" allowfullscreen></iframe>
</div><!-- end of video -->
<div id="weeklyadbox">
<p id="content"><img src="<?php bloginfo('template_url'); ?>/images/weeklyad.jpg" height="147" width="178" alt="Weekly Specials" border="0" title="Click to See Our Weekly Specials" /></p>
</div><!-- end of weeklyadbox -->
<div id="weathericon">
<img src="<?php bloginfo('template_url'); ?>/images/icons_03.png" border="0" alt="Weather Icon" title="See Weather" height="96" width="83" />
</div>
<div id="directionsicon">
<img src="<?php bloginfo('template_url'); ?>/images/icons_04.png" border="0" alt="Directions Icon" title="Get Directions" height="94" width="96" />
</div>
<div id="webcamicon">
<img src="<?php bloginfo('template_url'); ?>/images/icons_05.png" border="0" alt="Web Cam Icon" title="Web Cam" height="96" width="84" />
</div>
</div><!-- end of container -->
<div id="footer">
©<?php echo date("Y"); echo " "; bloginfo('name'); ?>
</div>
</div>
<?php wp_footer(); ?>
The_permalink() is fine when I'm in the index section, but not when I'm on a different page. I tried using echo get_permalink(53), and it worked, but what happens when a client goes in the dashboard and creates a new post? The new post will have a different post ID, and that link will not point out to the new post, but will point out to the old post that has an ID equals to 53.
If you need to see other code, please let me know!
Any advice? Thank you for your help!
It looks like you are using the_permalink() outside the WP loop. get_permalink() works outside "the loop" because you are explicitly passing the "Post ID" to the function.
Read this page explaining "the loop"
http://codex.wordpress.org/The_Loop
From looking at the snippet you posted that appears to be the problem.
I posted some sample "loop" code below:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php /** YOUR CODE HERE **/ ?>
<?php endwhile; else: ?>
<p><?php
_e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
I'm guessing you misunderstood the functionality of the "the_permalink" function. It must be used inside the loop, and it will give you the url to the current post that is being processed within the loop. If you want to have a link that will always point to your posts page, you could use something like:
<?php
if(get_option('show_on_front') == 'page')
echo get_permalink(get_option('page_for_posts'));
else
echo bloginfo('url');
?>
I am using the ACF purely so the user can upload images to a predefined location and have assigned the page rules accordingly. Everything seems to be fine on the WP back-end, with the three images uploaded to the fields. However, on the font end, nothing apart from blank box is appearing at all where the images should be. Looking at the source that WP is outputting, there is only blank code:
<img src="" class="middle" alt="image1"/>
This is the loop I am using:
<?php query_posts("posts_per_page=1&post_type=page&page_id=168"); if (have_posts()) :
while ( have_posts() ) :
the_post(); ?>
<!--If you want to refer to the child of parent page, use "post_parent=" -->
<li>
<h3><?php the_title(); ?></h3>
<?php the_excerpt(); ?>
<img src="<?php the_field('image_1'); ?>" class="middle" alt="image1"/>
View More
</li>
<?php endwhile; ?>
<!-- post navigation -->
<?php else: ?>
<!-- no posts found -->
<?php endif; ?>
<?php wp_reset_query(); ?>
It is important to note that I am not pulling the images from another page. I just want the images to relate to the template & page I am working on.
Make sure the image field is outputting the id or url of the image link.
<?php if(get_field('YOUR FIELD NAME')): while(has_sub_field('YOUR FIELD NAME')): ?>
<img class="logo" src="<?php the_sub_field('image_1'); ?>" />
<?php endwhile; endif; ?>
I just needed to nominate the home page id the function:
<img src="<?php the_field('image_2', '245'); ?>" class="middle" alt="image2"/>
you can use get_the_field() to get the right value of the field,
<img src="<?php get_the_field('image_1'); ?>" class="middle" alt="image1"/>