Changing php link on a logo to an external site - php

How do I change homepage link (/) to an external link to another site in this code?
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" class="site-title site-logo-text" <?php echo esc_attr( $header_text_color ); ?>><?php echo esc_html( get_bloginfo( 'name' ) ); ?></a>

<a href="YOUR_OTHER_LINK_HERE" rel="home" class="site-title site-logo-text" <?php echo esc_attr( $header_text_color ); ?>><?php echo esc_html( get_bloginfo( 'name' ) ); ?></a>

If you have fixed url for the external link, you don't have to put it inside
Just put it inside the href attribute like so and that should do it

If you want that link to point to another (external) resource, then make it simple, remove the unnecessary PHP code and put the URI in the href attribute. As I put HTTPS://EXAMPLE.COM/ below.
<a href="HTTPS://EXAMPLE.COM/" rel="home" class="site-title site-logo-text" <?php echo esc_attr( $header_text_color ); ?>><?php echo esc_html( get_bloginfo( 'name' ) ); ?></a>

Related

Change my custom logo 'home destination' in Wordpress

header.php question here. I have a custom logo being used on a specific set of listings pages https://carolroyseteam.com/our-nice-home/ , I've assigned it using a body class assignment to swap the header $logo in the header.php. Then the rest of the site with the branding of the domain https://carolroyseteam.com/. Is there anything that can be done to assign a different url to the two $logo's?
To clarify my custom logo for Our Nice homes logo goes to '/our-nice-home/' and then have standard domain home logo link to the default logo cotainer ">
Using Divi Theme
<?php ob_start(); ?>
<header id="main-header" data-height-onload="<?php echo esc_attr( et_get_option( 'menu_height', '66' ) ); ?>">
<div class="container clearfix et_menu_container">
<?php
$logo = ( $user_logo = et_get_option( 'divi_logo' ) ) && ! empty( $user_logo )
? $user_logo
: $template_directory_uri . '/images/logo.png';
ob_start();
?>
<?php
$classes = get_body_class();
if (in_array('ournicehomeslogo',$classes)) {
$logo="/wp-content/uploads/2019/10/1-ONH-Logo-05-carolroyseteam.png";}
?>
<?php
$classes = get_body_class();
if (in_array('single-listing',$classes)) {
$logo="/wp-content/uploads/2019/10/1-ONH-Logo-05-carolroyseteam.png";}
?>
<?php
$classes = get_body_class();
if (in_array('search-results',$classes)) {
$logo="/wp-content/uploads/2019/10/1-ONH-Logo-05-carolroyseteam.png";}
?>
<div class="logo_container">
<span class="logo_helper"></span>
<a href="/our-nice-homes/">
<img src="<?php echo esc_attr( $logo ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>" id="logo" data-height-percentage="<?php echo esc_attr( et_get_option( 'logo_height', '54' ) ); ?>" />
</a>
</div>
<?php
$logo_container = ob_get_clean();
Got it! Wordpress Divi Theme users will appreciate that this logo_container is a default in the header.php file. This has been the easiest way to both custom logo a specific page or pages and then modify the home url.
<div class="logo_container">
<span class="logo_helper"></span>
<a href="<?php $classes = get_body_class();
if (in_array('ournicehomeslogo',$classes)) {
echo esc_url( home_url( '/our-nice-homes/' ) );}
else if (in_array('single-listing',$classes)) {
echo esc_url( home_url( '/our-nice-homes/' ) );}
else if (in_array('search-results',$classes)) {
echo esc_url( home_url( '/our-nice-homes/' ) );}
else{
echo esc_url( home_url( '/' ) );
} ?>">
<img src="<?php echo esc_attr( $logo ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>" id="logo" data-height-percentage="<?php echo esc_attr( et_get_option( 'logo_height', '54' ) ); ?>" />
</a>
</div>
<?php
$logo_container = ob_get_clean();

How do I add social sharing buttons?

I am on Wordpress and I can easily add a plugin, but that increases load time, looks common and old.
I am using the Brook theme, which a minimal theme. (http://www.defensionem.com/7th-and-3rd-fleet-to-be-combined/)
If you notice, only end at the blog I have my sharing options, Such as Facebook, Linkedin, Twitter.
Can I enable this in the Sidebar widget? I contacted my theme author and they said to me,
"Our social-sharing links are built in brook/share_block.php. You
could try creating a new custom widget, and use the code from
share_block.php. Alternatively, you could use a Text Widget, and input
directly html code for sharing. By using the markup and classes as we
did, you should be able to get the same style."
Here's my that php file. I tried various methods but it did not work. Guess everything is wrong.
Can you all help?
<?php
$theme_settings = brook_theme_settings();
if( has_post_thumbnail() ){
$share_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'xxl' );
$share_image = $share_image[0];
$share_image_portrait = wp_get_attachment_image_src( get_post_thumbnail_id(), 'portrait-m' );
$share_image_portrait = $share_image_portrait[0];
}else{
$share_image = '';
$share_image_portrait = '';
}
$share_excerpt = strip_tags( get_the_excerpt(), '<b><i><strong><a>' );
?>
<div class="social-nav social-nav--titles">
<ul class="social-nav__items">
<?php if( $theme_settings['sharing_email'] ): ?>
<li class="social-nav__item">
<a title="<?php _e( 'Email', 'brook' ); ?>" class="social-nav__link js-skip-ajax" href="mailto:?subject=<?php echo ( rawurlencode( get_the_title() ) ); ?>&body=<?php echo ( rawurlencode ( $share_excerpt . ' ' . get_the_permalink() ) ); ?>">
<?php _e( 'Email', 'brook' ); ?>
</a>
</li>
<?php endif; ?>
<?php if( $theme_settings['sharing_facebook'] ): ?>
<li class="social-nav__item">
<a title="<?php _e( 'Facebook', 'brook' ); ?>" class="social-nav__link js-sharer js-skip-ajax" target="_blank" href="http://www.facebook.com/sharer.php?u=<?php echo( rawurlencode( get_the_permalink() ) ); ?>">
<?php _e( 'Facebook', 'brook' ); ?>
</a>
</li>
<?php endif; ?>
<?php if( $theme_settings['sharing_twitter'] ): ?>
<li class="social-nav__item">
<a title="<?php _e( 'Twitter', 'brook' ); ?>" class="social-nav__link js-sharer js-skip-ajax" target="_blank" href="http://twitter.com/intent/tweet?text=<?php echo( rawurlencode( get_the_title() ) ); ?>&url=<?php echo( rawurlencode( get_the_permalink() ) ); ?>">
<?php _e( 'Twitter', 'brook' ); ?>
</a>
</li>
<?php endif; ?>
<?php if( $theme_settings['sharing_pinterest'] ): ?>
<li class="social-nav__item">
<a title="<?php _e( 'Pinterest', 'brook' ); ?>" class="social-nav__link js-sharer js-skip-ajax" target="_blank" href="http://pinterest.com/pin/create/button/?url=<?php echo( rawurlencode( get_the_permalink() ) ); ?>&media=<?php echo ( rawurlencode( $share_image_portrait ) ); ?>&description=<?php echo( rawurlencode( get_the_title() ) ); ?>">
<?php _e( 'Pinterest', 'brook' ); ?>
</a>
</li>
<?php endif; ?>
<?php if( $theme_settings['sharing_google'] ): ?>
<li class="social-nav__item">
<a title="<?php _e( 'Google+', 'brook' ); ?>" class="social-nav__link js-sharer js-skip-ajax" target="_blank" href="https://plus.google.com/share?url=<?php echo( rawurlencode( get_the_permalink() ) ); ?>">
<?php _e( 'Google+', 'brook' ); ?>
</a>
</li>
<?php endif; ?>
<?php if( $theme_settings['sharing_linkedin'] ): ?>
<li class="social-nav__item">
<a title="<?php _e( 'LinkedIn', 'brook' ); ?>" class="social-nav__link js-sharer js-skip-ajax" target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&url=<?php echo( rawurlencode( get_the_permalink() ) ); ?>&title=<?php echo( rawurlencode( get_the_title() ) ); ?>&summary=<?php echo ( rawurlencode ( $share_excerpt ) );?>&source=<?php echo ( rawurlencode( get_bloginfo('name') ) );?>">
<?php _e( 'LinkedIn', 'brook' ); ?>
</a>
</li>
<?php endif; ?>
</ul>
</div>
Well What I suggest you which is the easiest solution is first install a plugin from this link https://wordpress.org/plugins/php-code-widget/ It ia a plugin when you activate it, it creates a widget in which you can put your all php code from your required file. As far as the styling is concerned you can add the relevant styling to main css file of your Brook theme. I hope it helps....
Try to social share plugin and put shortcode.

2 different fonts in Wordpress Title PHP?

I'm using Wordpress with plugins "Wordpress SEO".
I would like to put 2 different fonts in my Title.
example : Core Events Ireland; 'Core Events' in blue, and 'Ireland' in red.
How can I make that by plugins or PHP ?
Does it work in header.php ?
I think it's in this line :
<h1 class="site-title">
<a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
<?php bloginfo( 'name' ); ?>
</a>
</h1>
Can you tell me if I'm right, and if that doesn't make error with my plugins Wordpress SEO ?
You would need to add some structure to your header, so could not use the bloginfo function directly.
<h1 class="site-title">
<a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
<span class="title-front">Core Events</span> <span class="title-back">Ireland</span>
</a>
</h1>
You can then style .title-front and .title-back any way you want, e.g. color.
This should not interfere with WordPress SEO, because you are not modifying any of the SEO related tags, but just changing the look of the header.

change header top banner content on specific page

I have a static top banner inside my header.php file build like this :
<div class="row-fluid top-banner">
<div class="container">
<div class="banner-overlay"></div>
<?php
$logo = of_get_option('logo', '' );
if ( !empty( $logo ) ) { ?>
<a class="brand brand-image" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img src="<?php echo $logo; ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"><h1><?php if(!of_get_option('disable_description')){ ?><small><?php bloginfo( 'description' ); ?></small><?php } ?></h1></a>
<?php }else{ ?>
<a class="brand brand-text" href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><h1><?php bloginfo( 'name' ); ?><?php if(!of_get_option('disable_description')){ ?><small><?php bloginfo( 'description' ); ?></small><?php } ?></h1></a>
<?php }
if(of_get_option('disable_description')){ $top_banner_fix = 'style="top:15px;"'; }else{ $top_banner_fix = ''; }
?>
</div>
</div>
What I want to do is to change top-banner div content on a specific page, in my case the contact page which is created from the dashboard is not a template page.
So, I'm thinking to use the conditional tag :<?php is_page($page); ?>
The problem is that I'm not sure how to use this function. Is it possible to just add some markup inside the div and it will overwrite the existing one ?
Can you please give me some indications on how can I do this ?
Thank you!
is_page is a boolean function, so it's as easy as a new if else clause:
<div class="row-fluid top-banner">
<div class="container">
<div class="banner-overlay"></div>
<?php
$logo = of_get_option('logo', '' );
if (is_page($contactPage)) {
/*PUT STATIC CONTENT HERE*/
} else if ( !empty( $logo ) ) { ?>
<a class="brand brand-image" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img src="<?php echo $logo; ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"><h1><?php if(!of_get_option('disable_description')){ ?><small><?php bloginfo( 'description' ); ?></small><?php } ?></h1></a>
<?php }else{ ?>
<a class="brand brand-text" href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><h1><?php bloginfo( 'name' ); ?><?php if(!of_get_option('disable_description')){ ?><small><?php bloginfo( 'description' ); ?></small><?php } ?></h1></a>
<?php }
if(of_get_option('disable_description')){ $top_banner_fix = 'style="top:15px;"'; }
else{ $top_banner_fix = ''; }
?>
</div>
</div>
For $contactpage: when you are logged in into your Wordpress admin site, go to the frontend. Then go to the contact page (the one you want to have this new content on). Click on edit in the top banner. Look at the link. (You can also get there via the dashboard).
The link will look a bit like this: post.php?post=280&action=edit
That number, 280 in this case, is the ID of the page. You can use that for $contactPage:
if (is_page(280)) { /*...*/ }
Hope this helps :)
For different banner on all pages and posts you can use Attachment Plugin and then have to create instance for that in function.php file. then you can see that attachment metabox in all pages and post form page in admin panel.
Try this and let me know if any further help required.
Thanks!

Changing the header of the bliss wordpress template

I have this wordpress template: http://bluth.is/wordpress/bliss/
and I want to change the header. The subtitle should be UNDER the logo and not next to it. I have tried to make the content bigger and the logo smaller but nothing works. Any ideas?
The Code from the header.php:
<div class="span9" style="height:90px;">
<p>
<a class="brand brand-image" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img src="<?php echo $logo; ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"><?php if(!of_get_option('disable_description')){ ?></a>
</p>
<small><?php bloginfo( 'description' ); ?></small></div><?php } ?>
Using CSS margin you can move it wherever you want.
I don't know exactly the using pixles but here is how it suppose to be:
margin: 30px -100px 0;
Ofcourse there is a better way using photoshop to edit the logo and add him this subtitle.

Categories