Long URLs don't stay inside the Bootstrap column - css

I'm developing a WordPress theme with Bootstrap grids, and I see a problem in mobile view. Everything is fixed into the Bootstrap column, but there are some links in the references section that don't stay inside the column and make a mess of my grids and create a horizontal scroll bar:
I've tried everything and nothing works, please I need help.
Here is the code from the single.php:
<div class="c-content-box c-size-md" style="margin-top:4%;">
<div class="container">
<div class="row">
<div class="c-content-blog-post-card-1-grid">
<div class="row">
<div class="col-md-12">
<div class="col-md-8 wow animate fadeInLeft">
<div class="c-media 2 img">
<div class="c-overlay-wrapper">
<div class="c-overlay-content">
<?php the_post_thumbnail( '', array( 'style' => 'max-width:100%; height:auto;' ) ); ?>
</div>
</div>
</div>
<?php
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/content', get_post_format() );
?>
<div class="col-md-12 c-margin-b-60">
<?php
the_post_navigation( array(
'prev_text' => '<button type="button" class="col-md-5 col-md-offset-1 col-xs-6 btn btn-md c-btn-red c-btn-square ">Post Anterior</button>',
'next_text' => '<button type="button" class="col-md-5 col-md-offset-1 col-xs-6 btn btn-md c-btn-red c-btn-square ">Próximo Post</button>',
));
?>
</div>
<?php
echo '<div class="col-md-12 c-margin-t-20">';
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
endwhile; // End of the loop.
echo '</div>'
?>
</div>
<div class="col-md-4 ">
<div class="col-md-12 wow animate fadeInRight" >
<?php get_sidebar(); ?>
</div>
</div>
</main><!-- #main -->
</div><!-- #primary -->
</div>
</div>
</div>
</div>
</div>

You'll need to add some CSS to word-wrap your text.
div {
width: 100px;
border: 1px solid black;
margin: 5px;
}
.wrapped {
word-wrap: break-word;
}
<div>https://stackoverflow.com/questions/45800283/content-posts-doesnt-stay-inside-the-bootstrap-cols</div>
<div class="wrapped">https://stackoverflow.com/questions/45800283/content-posts-doesnt-stay-inside-the-bootstrap-cols</div>

.dont-break-out {
overflow-wrap: break-word;
word-wrap: break-word;
-ms-word-break: break-all;
word-break: break-all;
word-break: break-word;
-ms-hyphens: auto;
-moz-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;
}

Related

Running the loop outside of wordpress

I know that this has been posted many times, but I have truly spent close to 60 hours trying to figure this out - this is not my strong point!
Im running wordpress, standard installation, no plugins or anything at this stage.
I am simply trying to display the most recent 3 posts from the blog, or if we could go one step further, most recent 3 from catx.
Here is my code, which I believe should work.
<?php
require '/home1/digita/public_html/articles/wp-load.php'; ?>
<section class="services blog sec-normal">
<div class="container">
<div class="service-wrap">
<div class="row">
<style>.wp-block-image {
max-width: 100%;
margin-bottom: 1em;
display: none;
}
a.more-link {
display: none;
}
.services .service-wrap .service-section a {
margin-top: 0px!important;
}
</style>
<?php if (have_posts()) :
while ( have_posts() ) : the_post();
?> <!-- ***** BLOG ***** -->
<div class="col-md-4" style="width: 30%;margin-top: -7%;margin-bottom: 10%;">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail();
} ?>
<div class="service-section m-0" style="margin-top: 0.1%;">
<div class="title mt-0"><?php the_title(); ?></div>
<p class="subtitle"><?php the_content() ?> </p>
<hr>
Read more
</div>
</div>
<?php
// Stop the loop when all posts are displayed
endwhile;
// If no posts were found
else :
?>
<p>Sorry no posts matched your criteria.</p>
<?php
endif;
?>
</div>
</div>
</div>
</div>
</section>
The code does not return posts, and instead returns, "Sorry no posts matched your criteria." . Any advice?
Main query does not set it's data, because wp function did not run after wp-load.php in your code and main query must be set base on $_SERVER['REQUEST_URI'] that is a few complex.
But its good to use secondary query as simple way for your work:
<?php
require '/home1/digita/public_html/articles/wp-load.php';
$query = new WP_Query(array(
'post_type' => 'post',
));
?>
<section class="services blog sec-normal">
<div class="container">
<div class="service-wrap">
<div class="row">
<style>.wp-block-image {
max-width: 100%;
margin-bottom: 1em;
display: none;
}
a.more-link {
display: none;
}
.services .service-wrap .service-section a {
margin-top: 0px!important;
}
</style>
<?php if ($query->have_posts()) :
while ( $query->have_posts() ) : $query->the_post();
?> <!-- ***** BLOG ***** -->
<div class="col-md-4" style="width: 30%;margin-top: -7%;margin-bottom: 10%;">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail();
} ?>
<div class="service-section m-0" style="margin-top: 0.1%;">
<div class="title mt-0"><?php the_title(); ?></div>
<p class="subtitle"><?php the_content() ?> </p>
<hr>
Read more
</div>
</div>
<?php
// Stop the loop when all posts are displayed
endwhile;
// If no posts were found
else :
?>
<p>Sorry no posts matched your criteria.</p>
<?php
endif;
?>
</div>
</div>
</div>
</div>
</section>

Footer.php displaying different on different pages

I'm trying to update our mobile site over the last week but I'm hitting an issue with the footer. It loads up just fine on the home page but crashes when on a normal page. Both are using the same footer.php file.
The staging site that I'm working on is:
http://premierdism.staging.wpengine.com/
<?php
/**
* The template for displaying the footer.
*
*/
?> <div class="clearfix"></div>
</div><!-- .site_content .inner-wrapper -->
</div><!-- .site_content -->
<?php if(!is_front_page()):?>
<?php if(!is_page(52)):?>
<div class="page-cta">
<h4 style="font-family: Georgia;font-size: 40px !important; font-weight: bold; color: #075aa0;">Free, No Obligation</h4>
<h5 style="font-size: 40px !important; font-weight: 500; line-height: .6 !important; margin-top: 0px; color: #075aa0;;">Disability Evalution</h5>
<hr style="border-top: 1px solid #39393b; width:90%;">
<p style="font-size: 30px !important;">Let us help you determine if you<br>qualify for disability income<p>
<div style="height:20px;"></div>
<a title="Free social Security Evaluation" href="http://premierdism.staging.wpengine.com/contact-us/free-evaluation/">Free Evaluation</a>
</div>
<?php endif;?>
<img src="http://premierdism.staging.wpengine.com/wp-content/uploads/2016/09/Premier_Bottom_Logos.png" />
<?php else:?>
<div class="home-map">
<div class="inner-wrapper">
<?php
$args = array(
'numberposts' => -1,
'post_parent' => 56,
'post_type' => 'page',
'orderby' => 'title',
'order' => 'ASC'
);
$children = get_children( $args );
?>
<?php if($children):?>
<div class="state-list">
<p style="align:left; Color:#a32a2f; margin-bottom:0px;"><b>Click the map below<br>for more state information</b></p>
<hr style="margin-top: 0px; margin-bottom: 0px; margin-right: 0px; width: 570px; border-top: 2px solid #a32a2f;" />
<p align="left">All 50 states and territories</p>
<a href="https://m.premierdisability.com/the-premier-difference/nationwide-disability-benefits/"><img src="http://premierdism.staging.wpengine.com/wp-content/uploads/2016/09/Premier_Map.svg" alt="Premier Disability offers nationwide help"/>
<div class="clearfix"></div>
</div>
<?php endif;?>
</div>
</div>
<?php endif;?>
<div class="clearfix"></div>
<div class="site-footer">
<div class="footer-disclamier">
<div class="inner-back">
<div class="inner-wrapper" style="background-color: #e3e3e3; width: 640px; margin: -20px 0px 0px -40px; padding: 20px 0px;">
<p class="sharelink">Keep in touch</p>
<div style="padding-bottom:80px;" class="social relative">
<div style="position: absolute; left: 20%;">
<a class="block left" href="https://www.facebook.com/PremierDisability" target="_blank"><img src="http://premierdism.staging.wpengine.com/wp-content/uploads/2016/09/Facebook-Icon.jpg" style="width:60px;"></a>
<a class="block left" href="https://plus.google.com/110325482012270783070" target="_blank"><img src="https://m.premierdisability.com/wp-content/uploads/2016/09/GooglePlus-Icon.png" style="width:60px;"></a>
<a class="block left" href="https://twitter.com/PremierDisSvcs" target="_blank"><img src="https://m.premierdisability.com/wp-content/uploads/2016/09/Twitter-Icon.png" style="width:60px;"></a>
<a class="block left" href="https://www.instagram.com/premierdisabilityservices/" target="_blank"><img src="https://m.premierdisability.com/wp-content/uploads/2016/09/Instagram-Icon.png" style="width:60px;"></a>
</div>
<div style="padding: 0px 109px; margin-top: 90px;">
<div class="applink Apple"></div>
</div>
</div>
</div>
</div>
<div class="small-disclaimer"><p style="font-size:12px !important;margin-top: 20px;line-height:1.2;"><b>Disclaimer:</b> We are a privately owned, nationwide advocacy service. Any information you receive on this site is not intended to be, nor should it be construed as, legal advice. Using this website or contacting us does not create any type of legal or fiduciary relationship. Premier Disability Services, LLC is neither affiliated with nor endorsed by the Social Security Administration or any other government agency or entity.</p></div>
</div>
</div>
<div class="copyright">
<div class="inner-back">
<div class="inner-wrapper">
<?php Theme::getCopyright()?>
</div>
</div>
</div>
</div><!-- .site-footer -->
</div><!-- #main .wrapper -->
</div><!-- #page -->
<?php wp_footer(); ?>
</body>
</html>
You can change margin-top: 90px to padding-top: 90px, in this spot:
<div style="padding: 0px 109px; margin-top: 90px;">
<a href="https://itunes.apple.com/us/app/premier-ssd/id1143571193?mt=8">
<div class="applink Apple"></div>
</a>
<a href='https://play.google.com/store/apps/details?id=com.goodbarber.premierdis&utm_source=global_co&utm_medium=prtnr&utm_content=Mar2515&utm_campaign=PartBadge&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'>
<div class="applink Google"></div>
</a>
</div>
Try moving the footer php into its own php file. Then simply include the file at the end of the page. I use this and it works.
To do this, take the code from the wp_footer() function and paste it in a new file.
Then include 'new-wp-footer.php'; on pages where it doesn't show up.
Update:
Try to turn on output buffering before you include. Then grab the the contents.
For example,
ob_start();
include('footer.php');
$footer_content = ob_get_clean();
echo $footer_content;

Sidebar area not floating correctly

I am trying to get a sidebar to appear correctly in Wordpress framework with some effort here but I am almost their but the sidebar needs to appear to the right of the text of the blog just beside the title to the far right
You can view the page in question here http://kvalixhu.digitalthinkersni.co.uk/blog/
Image for how I want it to display
https://nimbus.everhelper.me/client/notes/share/369625/9zqAVkxFA4iFRBTqA1E5mw20uuWOqgs8/
<?php
/**
* Template Name: BlogPosts
*/
get_header();
?>
<style>
#title_wrapper{
width:488px;
}
h2{
font-size:18px;
font-familly:verdana, arial, sans-serif;
line-height:16px;
display:inline;
padding:2px;
}
#dateinfo{
font-weight:bold;
}
</style>
<div id="main-content" class="main-content">
<?php
if (is_front_page()) {
get_template_part('featured-content');
}
?>
<div class="full-width page-header">
<div class="row">
<div class="column">
<h1>Blog</h1>
</div>
</div>
</div>
<div class="row show-for-medium-up">
<div class="column breadcrumb">
<?php
if (function_exists('yoast_breadcrumb')) {
//echo __('Home',TD) . ' > ';
yoast_breadcrumb('<span id="breadcrumbs">', '</span>');
}
?>
<?php
if (function_exists('bcn_display_list_multidim_children')) {
?><ul class="breadcrumbs">
<?php
bcn_display_list_multidim_children();
?>
</ul><?php
}
?>
</div>
</div>
<div class="row">
<div class="column small-12 product">
<?php
$logo = get_post_meta(get_the_ID(), 'logo', true);
?>
<div class="post-list" style="width:80%;">
<?php
$myposts = get_posts('numberposts=-1&offset=$debut');
foreach ($myposts as $post):
setup_postdata($post);
?>
<div id="dateInfo" style="float:right;">
<?php the_date('Y.m.j'); ?> |
<?php comments_number( '0 hozzászólás', '1 hozzászólás', '% hozzászólás' ); ?>.
</div>
<div id="title_wrapper">
<h2><?php the_title(); ?></h2>
</div>
<div class="thumbnail" style="float: left; margin: 10px">
<?php the_post_thumbnail( array( 395, 195 ) ); ?>
<div class="thumbnail-arrow"></div>
</div>
<!-- Display movie review contents -->
<div class="entry-content"><?php the_content(); ?></div>
<div>
<?php
endforeach;
?>
<div class="column small-6 product " style="float:right;">
<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Right Sidebar')) : ?>
[ do default stuff if no widgets ]
<?php endif; ?>
</div>
<hr />
</div>
</div> </div>
</div>
<?php
get_footer();
?>
The first thing that you would want to do is move the "sidebar div" outside of the post-list div, and adding "float:left;" to the post-list div.
Also, add a width to the sidebar div with "width: 20%;" to make sure it fits.
The answer is a bit vague but hopefully you understand.
Hopefully this helps

Wordpress sidebar goes wrong way in bootstrap

Basically, i split up the page in 2 columns, and tried inserting sidebar code into the right one (span4). But for some reason, it keeps showing under span8
page code
<div class="row pull-right"><div class="span12" id="hdimg"></div></div>
<div class="row pull-right" id="pgg">
<div class="span8" id="pagecn">
<?php the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-content">
<div class="ttl">
<?php if ( is_singular() ) {echo '<h1 class="entry-title">';} else {echo '<h2 class="entry-title">';} ?><a title="<?php printf( __('Read %s', 'blankslate'), the_title_attribute('echo=0') ); ?>" rel="bookmark"><?php the_title(); ?></a><?php if ( is_singular() ) {echo '</h1>';} else {echo '</h2>';} ?>
</div>
<div id="cn">
<?php the_content(); ?>
</div>
</div>
</div>
</div>
<div class="span4">
<?php if ( is_active_sidebar('primary-widget-area') ) : ?>
<div id="primary" class="widget-area">
<ul class="sid">
<?php dynamic_sidebar('primary-widget-area'); ?>
</ul>
</div>
<?php endif; ?>
</div>
</div>
</div>
<?php get_footer(); ?>
css for it
#hdimg {
width: 948px;
height:185px;
background-image: url(images/banner.jpg);
}
#pgg {
width:948px;
margin-top:4px;
background-color: white;
padding-top: 10px;
padding-bottom: 20px;
}
#cn {margin-top: 15px;}
link to see live
http://soloveich.com/project3/
#pgg {
width:948px;
margin-top:4px;
background-color: white;
padding-top: 10px;
padding-bottom: 20px;
}
Remove width
#pgg {
margin-top:4px;
background-color: white;
padding-top: 10px;
padding-bottom: 20px;
}
I see what you tried to do but you used it incorrectly - fix background in a different way
<div class="" id="hdimg"></div>
This is for your header - remove grid class
change #hdimg width to
hdimg { width: 960px !important; }

Center Content Twitter Bootstrap

I've nearly finished my website here: http://www.divisionforty.com/wall/ and I've come to the final part left is to get this content to center http://www.divisionforty.com/wall/artists/cali-balles/
Here is the code:
<?php get_header(); ?>
<div class="row">
<div class="span4">
<h2><?php the_title(); ?></h2>
<p>
<?php
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<?php the_content(); ?>
</div>
<?php
endwhile;
endif;
?> </p>
</div>
<div class="span8" id="thumbnails">
<?php postimage($size=thumbnail, $qty=-1) ?>
</div>
</div>
<?php get_footer(); ?>
There isn't really any style custom to that page so its basic bootstrap.
Hope someone can help,
Denver
To clarify this is what I'd like centered:
Try this
Take off the max-width:1280px from your #wrap div
on your .row div set the width to max-width:1200 and the margin to margin:0 auto
You could also add text-align: center; to your .row div so your text is centered.
That should keep your content centered as the page gets smaller. (not quite sure what you were looking for. This will make sure your header goes all the way across the page while centering the content beneath it.)
Create a new container class.
<div class="container_2">
<div class="row">
<div class="span4">
...
</div>
</div>
</div>
In your css, add this
.container_2 {
width: 1200px; //you can change this.
max-width: 100%;
margin-left: auto;
margin-right: auto;
display: block;
}
}

Resources