Concrete5: Change link in the header section - php

I have this div content in my header.php file contained in application/themes/custom_name/elements
<?php defined('C5_EXECUTE') or die("Access Denied.");
$this->inc('elements/header_top.php');
$cl_txt = $c->getAttribute('client_login_txt');
$cl_url = $c->getAttribute('client_login_url');
?>
......
<div class="login">
<a href="<?php echo $cl_url ?>" target="_blank">
<button type="button" class="btn-login"><?php echo $cl_txt ?></button>
</a>
</div>
I would like to change the link contained in the div.
Where can I do it?

There are two Page Attributes, the link URL is called Client Link URL and the link text is called Client Link Text, I was able to edit this by going to Full Sitemap and click on the page I am trying to change and select Attributes.

Related

WordPress How to link a button to a specific template page?

I have a website with several pages with links/buttons that should lead to a specific page.
Is there a way to link this buttons in a dynamic way, that does not include page ID?
Currently I am doing it this way, with ACF field in which I write in a page ID
<div class="projects-homepage-item">
<?php $projects_page = get_post(get_field('page_id')); ?>
<a href="<?php the_permalink($projects_page->ID); ?>" class="projects-homepage-item-img" target="_blank">
<?php the_post_thumbnail(); ?>
</a>
</div>
Is there something similar to this function that leads to blog/post page?
<div class="news-homepage-btn-wrapper">
<?php printf(__('Pogledaj sve novosti', 'femix')); ?>
</div>

How to link to a specific part of a page HTML PHP

I am trying to link to a specific part in my php page. I have tried all the other answers on here but none of them have helped my special problem. This is how I am trying to go to the link
<a href="<?php echo $userLoggedIn; ?>#posts_tab">
So when the user clicks the dropdown they see a list of things. One of those things being the word Profile and when the user clicks on their profile they go to their own personal profile. When they are there they have a list of items at the top that look like this:
So what I want to do is when they click the profile they are automatically on the Profile Posts tab. Like a default option. For some reason it's not working for me and I can't figure out why. Any help please ?
header.php:
<a href="<?php echo $userLoggedIn; ?>#posts_tab">
</a>
profile.php:
<a style="color: #000;" id="posts_tab" href="javascript:void(0)" onclick="openCity(event, 'Posts');">
<div class="w3-third tablink w3-bottombar w3-hover-light-grey w3-padding">
<center>Profile Posts</center>
</div>
</a>
I believe this is what you want, you need to let your profile page know that you want to load that part of profile.php, you can do it different ways I have used php and GET as example, I've sent a parameter on the URL and received it on profile.php
header.php
<a href="<?php echo $userLoggedIn; ?>?tab=posts_tab">
profile.php
<?php
$tab = $_GET["tab"];
if ($tab == "posts_tab"){
?><script>openCity(event, 'Posts');</script><?php
}
?>
<a style="color: #000;" id="posts_tab" href="javascript:void(0)" onclick="openCity(event, 'Posts');">
<div class="w3-third tablink w3-bottombar w3-hover-light-grey w3-padding">
<center>Profile Posts</center>
</div>
</a>

php - open href like page to specific position

I'd like to know if it's possible to open a page (id=26) at a specific position: .
At the front page i'm using this code at the php file to make the title link to the page
<a href="<?php echo get_page_link(26); ?>">
<?php if(!empty( $clean_biz_home_service_title ) ){ ?>
<h2>
<?php echo esc_html( $clean_biz_home_service_title); ?>
</h2>
</a>
Yes, you can use DOM selectors such as #maincontent. You would need to assign an ID to a section on the page and then append it to the trigger URL.
For ex: http://yourdomain.com/index.html#maincontent would take you to that div on the page.
First, in the content of that page (id=26), you need to add an id attribute to some tag, like so:
<div id="myposition">
...
</div>
Next, append #myposition after the get_page_link(26) call:
<a href="<?php echo get_page_link(26); ?>#myposition">
<?php if(!empty( $clean_biz_home_service_title ) ){ ?>
<h2>
<?php echo esc_html( $clean_biz_home_service_title); ?>
</h2>
</a>
And you are done.
<div name="position">
content
</div>
link
example:
if you click the link below you will open this page at #new-answer position
link

Change logo destination URL for only one page

How do you change the logo to link to the home URL for all pages except one? I want one page to link to another page when the logo is clicked.
Here is the PHP code for the logo:
<div class="section-boxed section-header">
<?php do_action('pexeto_before_header'); ?>
<div id="logo-container">
<?php
$logo_image = pexeto_option('retina_logo_image') ? pexeto_option('retina_logo_image') : pexeto_option('logo_image');
if(empty($logo_image)){
$logo_image=get_template_directory_uri().'/images/logo#2x.png';
}
?>
<img src="<?php echo $logo_image; ?>" alt="<?php esc_attr(bloginfo('name')); ?>" />
</div>
What about creating a second section of PHP - with a slightly different DIV ID that is called when that paticular page is loaded, rather than this one which is called on all the other pages,
Copy, paste, change DIV ID <div id="logo-container2">, change link address.
In HTML - on the single page that takes them elsewhere - call
<div id="logo-container2">
Would that work?
Try to use template_tag is_page as condition
<div class="section-boxed section-header">
<?php do_action('pexeto_before_header'); ?>
<div id="logo-container">
<?php
$logo_image = pexeto_option('retina_logo_image') ? pexeto_option('retina_logo_image') : pexeto_option('logo_image');
if(empty($logo_image)){
$logo_image=get_template_directory_uri().'/images/logo#2x.png';
}
// Default logo url to home
$logo_url = esc_url(home_url('/');
// if is page about or id 5 anything inside is_page()
if(is_page('about') $logo_url = esc_url(home_url('about');
?>
<img src="<?php echo $logo_image; ?>" alt="<?php esc_attr(bloginfo('name')); ?>" />
</div>
I believe you should be able to use the get_permalink method to check which page you are on, and use an if statement to tell it what the href should be.
<a href="<?= (get_permalink() == '/my-page') ? esc_url(home_url('/go-to-page')) : esc_url(home_url('/')); ?>">
Haven't tested this, but it should work.

How do I change this php popup to a link?

I'm looking to change this bit of code to a link instead of having it appear as a small popup window. How would I change it to link to a page of "http://example.com/register" instead of having the registration window drop down?
<div class="login-wrapper">
<a id="sticky-login" class="info-bottom icon-login sticky-button" title="<?php _e('Login',IT_TEXTDOMAIN); ?>"></a>
<div class="sticky-form" id="sticky-login-form">
<div class="loading">
<div> </div>
</div>
<?php echo it_login_form(); ?>
</div>
</div>
This seems too easy so I'm probably missing something.
You'd add an href attribute to the <a> tag, and if javascript is creating the popup, remove either the id attribute from the <a> tag or the class to which the javascript is linked.
<a class="info-bottom icon-login sticky-button" title="<?php _e('Login',IT_TEXTDOMAIN); ?>" href="http://example.com/register"></a>

Categories