Trying to add default text to show before called header text - php

Trying to add default text (LEARN MORE:) in same h5 heading just before the called get_the_title hook.
what shows now example:
MLS# T3110937 9313 MANDRAKE CT, TAMPA, FL 33647
Example of adding LEARN MORE: always being added before the called title hook:
LEARN MORE: MLS# T3110937 9313 MANDRAKE CT, TAMPA, FL 33647
Here is the code I am working with:
<div class="overlay">
<div class="container">
<h1><?php echo balanceTags($title);?></h1>
<li>
<div class="pull-left"><?php echo balanceTags($title);?> </div>
<h5>
<div style="text-align: center;">
<?php echo get_the_title();?>
</div>
</h5>
</li>
</div>
</div>

I think what you are looking for is
<div style="text-align: center;">
<?php echo 'Learn More: ' . get_the_title();?>
</div>
To concatenate in php, add a . between two or more output variables.
You can also put the text on the outside of the PHP tag.
<div style="text-align: center;">
Learn More: <?php echo get_the_title();?>
</div>

Try this, I think you also need the permalink on that text.
<div class="overlay">
<div class="container">
<h1><?php echo balanceTags($title);?></h1>
<div class="pull-left"><?php echo balanceTags($title);?></div>
<h5 style="text-align: center;">
<?php the_title(); ?> Learn More
</h5>
</div>
</div>
Also give a bounce to this:
https://developer.wordpress.org/reference/functions/the_permalink/

Related

database values not displaying in carousal in codeigniter php

i have a website in which i used carousel sliders to display images and its values, I have 3 carousel in my homepage, 3 of them have same code, however the first carousel is not displaying name and price like the 2nd and 3rd carousel:
as you can see in the image
the code for this carousel is below:
<section class="carousel_sec">
<div class="container">
<div class="row ">
<h3 class="carousel_heading">Trending Birthday Cakes <button class="pull-right"><span>VIEW ALL</span><!-- <span class="visible-xs">>></span> --></button></h3>
<hr>
<div class="carou">
<div class="demo">
<ul id="landing_products1">
<?php foreach($trending_products1 as $key=>$val) { ?>
<li>
<div class="item">
<div class="pad15 content_div">
<div class="carou_thumb">
<img class="st_img" src="<?php echo ADMIN_IMG.'cakes/'.$val['image'][0]['cake_image'];?>" alt="<?php echo $val['cake_name']; ?>" />
<img class="nd_img" src="<?php echo ADMIN_IMG.'cakes/'.$val['image'][0]['cake_image'];?>" alt="<?php echo $val['cake_name']; ?>" />
<p>
<?php echo $val['cake_name']; ?>
</p>
<?php
$btp_price=0;$offer_price=0;
$btp_price=$val['price'][0]['btp_price'];
$offer_price=$val['price'][0]['offer_price'];
?>
<div class="price text-center" style="width:100%;float:left;">
<span class="amount" style="color:#f2136e;font-size:14px;">
<?php echo PRICE_UNIT;?><?php echo $offer_price;?>
</span> (
<s> <?php echo $btp_price;?></s>)
<span> </span>
<br>
</div>
<!--<br><span><?php echo PRICE_UNIT;100; ?></span></p>-->
</div>
</div>
</div>
</li>
<?php } ?>
</ul>
</div>
</div>
</div>
</div>
</section>
<?php } ?>
while inspecting in browser the value is showing, the live URL is enter link description here
can anyone please tell me what could be wrong here, thanks in advance
You'll need to tweak the css to reveal the content that is hidden.
To push you in the direction, see the improvement with:
#landing_products1 {
height: 330px;
margin-top: -65px;
}
I don't know how responsive you need to be with your UI, so let's call this a temporary fix. The first carousel's dimensions don't perfectly match the others, so I'll leave the fine tuning to you.
It also appears that you have some js and css issues to mop up.

bootstrap 4 cards with php foreach loop

Iam trying to get my web page to display all of my shop items in bootstrap 4 cards. 3 wide by however many deep ( i may add pagination another day )
I've got a php foreach loop which populates bootstrap4 cards perfectly. The trouble is they display vertically ( one on top of the other ) . ive tried class= columns which works on dummy divs but not when i integrate with my for each loop.
I ve tried everything regarding bootstrap docs but cant get the cards to display 3 wide and however many deep ( the foreach and the items control this. )
Should i be even using 'cards' or use something else. thx for your time
<div class="container">
<!-- $result = my php code using x-path to get results from xml query goes here. -->
<?php
foreach ( $result as $elements){
?>
<div class="row-fluid ">
<div class="col-sm-4 ">
<div class="card-columns-fluid">
<div class="card bg-light" style = "width: 22rem; " >
<img class="card-img-top" src=" <?php echo $elements->pictures->picture[2]->filename ; ?> " alt="Card image cap">
<div class="card-body">
<h5 class="card-title"><b><?php echo $elements->advert_heading ?></b></h5>
<p class="card-text"><b><?php echo $elements->price_text ?></b></p>
<p class="card-text"><?php echo $elements->bullet1 ?></p>
<p class="card-text"><?php echo $elements->bullet2 ?></p>
Full Details
</div></div></div></div>
<?php
}
}
?>
</div>
</div> <!--container close div -->
As stated, the .row-fluid should be outside of the loop :
<div class="container">
<div class="row-fluid ">
<!-- my php code which uses x-path to get results from xml query. -->
<?php foreach ( $result as $elements) : ?>
<div class="col-sm-4 ">
<div class="card-columns-fluid">
<div class="card bg-light" style = "width: 22rem; " >
<img class="card-img-top" src=" <?php echo $elements->pictures->picture[2]->filename ; ?> " alt="Card image cap">
<div class="card-body">
<h5 class="card-title"><b><?php echo $elements->advert_heading ?></b></h5>
<p class="card-text"><b><?php echo $elements->price_text ?></b></p>
<p class="card-text"><?php echo $elements->bullet1 ?></p>
<p class="card-text"><?php echo $elements->bullet2 ?></p>
Full Details
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div> <!--container div -->
You need to move your <div class="row-fluid "> class outside of the foreach loop, otherwise it will create a new row for each class.
Also, as a comment has mentioned, you need to close all your divs correctly.

How to make a button show on mobile

Good day everyone.
Just started working in Firm that has given me task to optimize their website (nigeria-friends(dot)com/staging.academix) responsively, which I have been doing gradually and am not all that proficient with PHP, HTML and CSS. But, I can confidently read and understand some couple of stuff in them. Thus;
I have been trying to center all the contents on the frontpage image banner
Reveal or make a particular button "How Academix can benefit you" appear on mobile devices of max-width:380px with no success and that has got me perplexed.
I have searched all through the CSS and couldn't get my head around any to fix it. Hence, me calling for help. And having looked into the index.html from the based folder I found something, the aforementioned buttons were in a loop sort of, which I don't understand.
Here is the index code:
<div class="col-sm-12 col-xs-10 col-centered">
<?php if(!isset($_SESSION["acc_identifier"])){ ?>
<!--
<div class="col-sm-4 col-centered">
<a href="<?php echo $URLMAIN; ?>/access/signup.html">
<div id="fb-login" class="social-login">
<div class="social-text">Sign up for free</div>
</div>
</a>
</div>
-->
<div class="col-sm-6 col-centered">
<a href="<?php echo $URLMAIN; ?>/about/benefits.html">
<div id="yahoo-login" class="social-login">
<div class="social-text">How <?php echo $web_shortName; ?> can benefit you</div>
</div>
</a>
</div>
<div class="col-sm-6 col-centered">
<a href="<?php echo $URLMAIN; ?>/access/host.html">
<div id="g-login" class="social-login">
<div class="social-text">Host your journal on <?php echo $web_shortName; ?></div>
</div>
</a>
</div>
<?php }else{ ?>
<div class="col-sm-6 col-centered">
<a href="<?php echo $URLMAIN; ?>/about/benefits.html">
<div id="yahoo-login" class="social-login">
<div class="social-text">How <?php echo $web_shortName; ?> can benefit you</div>
</div>
</a>
</div>
<div class="col-sm-6 col-centered">
<a href="<?php echo $URLMAIN; ?>/access/host.html">
<div id="g-login" class="social-login">
<div class="social-text">Host your journal on <?php echo $web_shortName; ?></div>
</div>
</a>
</div>
<?php } ?>
</div>
I can't paste in all the index.html code here as is quite long and length, which is generating error format when I try to, which is mixed php and html, where PHP starts the index.html. So also is the CSS file.
#media (min-width: 380px){
#yahoo-login .social-text {
display: none;
}
}
OR
#media (max-width: 380px){
#yahoo-login .social-text {
display: block;
}
}

Jump to next section in while loop

OK, this is a bit complicated so Ill try my best to explain it:
I have a while loop which has a next link, before I just had it in standard html, so it was farely simple, on click of the class 'arrow' it would just to the next section e.g:
$i = 0;
while ( have_rows('sections') ) : the_row();
$sectionName = $i++;
?>
<section id="<?php echo $sectionName; ?>" class="full-bg-image" style="background-image: url('<?php the_sub_field('section_image'); ?>')">
<div class="image divider" id="partnersImg" style="background-image: url('<?php the_sub_field('section_image'); ?>')">
<div class="wrapper">
<div class="overlay" style="color: <?php the_field('section_text_colour','options'); ?>">
<?php the_sub_field('divider_text'); ?>
</div>
</div>
</div>
<div class="sectionContent">
<div class="wrapper">
<div class="centerContent">
<div class="contentWrapper">
<div class="text animation-element" data-sr="enter center wait 0.5s, no reset" style="background-color: <?php the_field('text_block_bg_colour','options'); ?>; color: <?php the_field('text_block_text_colour','options'); ?>">
<?php the_sub_field('section_text'); ?>
<div class="arrowContainer"></div>
</div>
<div class="clr"></div>
</div>
</div>
</div>
</div>
</section>
<?php endwhile;
The sectionName variable is set for each item name that is added in the wordpress admin however the issue comes when my above code shows and the anchor is linking too itself and not the next section, I would like to know how to link it to the next section and if its the last section then to have a anchor which links to the first.
<section id="0">
<div class="arrowContainer"></div>
</section>
<section id="1">
<div class="arrowContainer"></div>
</section>
<section id="2">
<div class="arrowContainer"></div>
</section>
<section id="3">
<div class="arrowContainer"></div>
</section>
In this case I am using Advanced Custom Fields repeater and not posts.

CakePHP custom setFlash

I've read on the CakePHP Book that you can define your own custom setFlash messages using an element... but what I would I put inside the element and how would I pass different content.
So for example two different messages:
<div id="flashMessage" class="message">
<div class="content">
<p>Please correct the errors</p>
</div>
</div>
<div id="flashMessage" class="announcement message">
<div class="content">
<h3>Announcement</h3>
<p>You have earned a new achievement</p>
</div>
</div>
So as you can see I want to define a wrapper div and a content div and then also pass in an additional class if need be dependant on the kind of message and also show different content such as just a paragraph or a header and a paragraph.
Can anyone help? Thanks
You can have two elements:
myflash.ctp
<div id="flashMessage" class="message">
<div class="content">
<p><? echo $message ?></p>
</div>
</div>
announcement.ctp
<div id="flashMessage" class="announcement message">
<div class="content">
<h3>Announcement</h3>
<p><? echo $message ?></p>
</div>
</div>
and then:
$this->Session->setFlash($message,'myflash or announcement');
or one element:
myflash.ctp
<div id="flashMessage" class="<? echo (isset($myclass)?$myclass.' ':'') ?>message">
<div class="content">
<? echo (isset($header)?'<h3>' . $header.'</h3>':'') ?>
<p><? echo $message ?></p>
</div>
</div>
and at your controller:
$this->Session->setFlash($message,'myflash',array('myclass'=>'announcement','header'=>'Announcement');

Categories