I'm creating custom elements in WPBakery (formerly Visual Composer), but encountering issues with its rendered markup.
For example:
I've created a custom element called text. text currently spans 12 columns in the WP admin:
The rendered markup for this looks like:
<div class="row justify-content-center">
<div class="text">
<div class="text-left container">
<h2>This is header</h2>
<p>This is content</p>
</div>
</div>
<div class="col-sm-12">
<div class="vc_column-inner">
<div class="wpb_wrapper"></div>
</div>
</div>
</div>
As you can see, it's creating an empty col-sm-12 div and not even applying the column styles to text.
Ideally what I want to do is get the column WPBakery is generating and place it in a variable.
This way, I can do something along the lines of:
<div class="text <?php echo $column; ?>">
I think this will be handy when a user eventually decides they want two text blocks next to each other:
So each text block will be col-6.
To summarise, I'm trying to figure out why Bakery is outputting an empty div with columns rather than to wrap around my text block? As I'm not sure why this is happening, the only solution I can think of is to get the column data as a variable and then echo is in the text block.
Related
I am trying to create a html code template. The problem is there are two html code template saved on different table my problem is merging the two codes when generating.
Here is a simple example:
Database Table 1 - this is where I store the structure of the html section:
<div class="card">
<div class="card-body">
// content will be put here
</div>
</div>
Database Table 2 - this is where I store the content that will be going inside on what's inside the Table 1.
<h5 class="card-title">Special title treatment</h5>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
Go somewhere
When generated the html code should look like this
<div class="card">
<div class="card-body">
<h5 class="card-title">Special title treatment</h5>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
Go somewhere
</div>
</div>
The reason I did like this is because the contents inside are flexible meaning can be added, removed, reorganized. What can I do to achieve this?
You can add an anchor on your first table.
<div class="card">
<div class="card-body">
<my-unique-tag>
</div>
</div>
and replace that anchor with your second table data.
$result = str_replace('<my-unique-tag>', $secondData, $firstData);
how would I go about having different views for an article in Code Igniter.
For example I have one Index for all articles and I also have a view. But what If I want to have say 10 pictures for one article and only three for another?
So my view is:
<div id="wrapper">
<div id="main-wrapper" class="col-md-10 pull-right">
<div id="main">
<div class="col-md-9">
<div id="sec#" class="">
<h2><?= $article['title']?></h2>
<img border="0" src="<?= assetUrl() ?>img/article/<?= $article['image']?>">
<h6>Date: <?= $article['date']?></h6>
<h6>Author: <?= $article['author']?></h6>
<br>
<p><?= $article['body']?></p>
</div>
</div>
</div><!--/right-->
</div><!--Main wrapper-->
</div><!--Wrapper-->
All the articles look the same. But what if I want to have pictures within the body of the article? And what if the number of pictures are different for each article.
I'm struggling with this, because all the articles look the same. And depending on the text, it would be nice to render pictures on different parts of the body.
Also, I've been adding HTML tags in the longtext and I save them in the database. Isn't this dangerous? I'm sure there must be a better way of doing this. But if I don't put any tags, the body just displays as one big blob of text.
I'm creating a website with wordpress.
I created a gallery with the Media Library of the wordpress and
I also created template page-portfolio.php all with php (wordpress) and everything works fine.
With the Inspect Element I check in the page-portfolio.php HTML code with tags which was generated automatically by wordpress.
<div id="gallery-1" class="gallery galleryid-11">
<div class="myGalleryItem"><a ref="..."><img src="..."></a><span>...</span></div>
<div class="myGalleryItem"><a ref="..."><img src="..."></a><span>...</span></div>
<div class="myGalleryItem"><a ref="..."><img src="..."></a><span>...</span></div>
...
and I want to change that HTML tags to the following code:
<div class="wrap">
<div class="box">
<div class="boxInner">...</div>
<div class="box">
<div class="boxInner">...</div>
<div class="box">
<div class="boxInner">...</div>
...
the goal is to customize the HTML tags in order to adjust i.e. adptar a CSS gallery grid photos see link:http://www.dwuser.com/education/content/creating-responsive-tiled-layout-with-pure-css/
How can I modify the wordpress HTML code with tags that was generated automatically ?
Thanks
I'm creating a simple website that collates all of my tweets into a "wall" using a WP plugin. The problem is though that the entire body of the tweet (Links, text, hashtags, etc.) is pulled into the_content whereas I only want to display the a particular chunk of content.
Is there a way that I can completely remove everything else from an element using PHP?
This is my example markup;
<div class="element">
<div class="overlay">
<p>#username This is some plain text. http://www.t.co/xxxxxxx #twitterhashtag</p>
</div>
</div>
I want to remove everything apart from the #username. Is that possible?
Try this
<?php $content = get_the_content();
$pieces = explode("</a>", $content);
<div class="element">
<div class="overlay">
<p>echo $pieces[0]."</a>";</p>
</div>
</div>
I am getting this oddball extra <br> inserted into this page above the "Affiliate" title/section. http://londoncapital.biz/affiliate-program/
Using either Firebug or Element Inspector, I still cannot determine where this is coming from.
This is the generated HTML.
<div class="entry clearfix">
<div class="two_thirds"></div>
<div class="one_third last" style="text-align: justify;"></div>
<hr class="clear">
<p></p>
<div class="one_third"></div>
<p></p>
<p></p>
<div class="one_third"></div>
<br> (THIS SEEMS TO BE THE OFFENDING ELEMENT I THINK)
<div class="one_third last"></div>
<div class="clear"></div>
<br>
I have gone over the page coding in WP page itself and and all three of those sections are identical.
What am I missing here? Some errant code in some php file?
UPDATE INFO: This is the actual code from the WordPress page: http://pastebin.com/pwJbAGdg
I can't paste the whole code here because I'll be here forever trying to clean up the formatting from the paste.
Surely using this stuff in editor is really cool but if you REALLY need it you can just remove spaces, copy this stuff:
<div class="entry clearfix"><div class="two_thirds"></div><div class="one_third last" style="text-align: justify;"></div><hr class="clear"><div class="one_third"></div><div class="one_third"></div><div class="one_third last"></div><div class="clear"></div><br>
Open Wordpress Super editor and go to TEXT mode - !important
Paste it - should work.
But that's not the best coding sample :)