How to add a custom wordpress isotope project portfolio pagination - pagination

How can I add a pagination to my isotope portfolio page?
I want each filter work with a max item of 8 and use pagination to check next 8 items.
Below is my custom Template Name: Portfolio
<?php $t =& peTheme(); ?>
<?php $title = get_the_title(); ?>
<?php $pcontent = get_the_content(); ?>
<?php $pcontent = apply_filters( 'the_content', $pcontent ); ?>
<?php $project =& $t->project; ?>
<?php list($portfolio) = $t->template->data(); ?>
<?php $content =& $t->content; ?>
<div class="container">
<div class="row">
<div class="span12">
<h1><?php echo $title; ?></h1>
</div>
</div>
<div class="row">
<div class="span12">
<nav class="portfolio-filter clearfix">
<ul>
<?php $project->filter('',"keyword"); ?>
</ul>
</nav>
</div>
<hr class="main-hr-sm">
<?php echo $pcontent; ?>
</div>
<div class="row portfolio-container">
<?php while ($content->looping()):
$meta =& $content->meta(); ?>
<div class="span3 portfolio-item <?php $project->filterClasses(); ?>">
<a href="<?php echo $t->image->resizedImgUrl($content->get_origImage(),1000,1000); ?>" class="fancybox" data-portfolio="<?php $content->slug(); ?>">
<img src="<?php echo $t->image->resizedImgUrl($content->get_origImage(),460,300); ?>" alt="<?php echo esc_html(get_the_content()); ?>">
</a>
<div class="caption">
<?php $content->content(); ?>
</div>
</div>
<?php endwhile; ?>
</div>
</div>

Pagination isn't built into Isotope so you'd have to build it from the ground up. Here is a good tutorial on how to do that with Wordpress and Isotope v1. Keep in mind the tutorial is using Isotope v1 so you'll have to change it if you want to use Isotope v2 but the general concepts in the tutorial should still be very helpful.

Related

How do I rewrite string query url when a form is submitted using .htacess

I have a form like this that after submitting url is like localhost/Direct-Link/product-details?details-id=173
I want it to be like: localhost/Direct-Link/product/173
<form action="product" method="get">
<input type="hidden" name="detail-id" id="detail-id" value="<?php echo $row['product_id']; ?>">
<a onclick="javascript:this.parentNode.submit();">
<img src="<?php echo $string_to_array[0]; ?>" alt="<?php echo $string_to_array[0]; ?>">
<div class="card-title mt-2">
<p id="big"><strong>
<?php echo $row['product_title']; ?>
</strong></p>
<p id="big"><b>
<?php echo 'Ksh. ' . $row['product_price']; ?>
</b></p>
<p>
<?php echo $row['product_keywords']; ?>
</p>
<?php if (!empty($row['stock_needed'])) { ?>
<p class='w-100 m-0 p-0'>
<?php echo 'Stock needed. ' . $row['stock_available']; ?>
</p>
<?php
} ?>
<p><i class="fa-solid fa-location-dot"></i>
<?php echo 'Location: ' . $row['specific_location']; ?>
</p>
</div>
</a>
</form>
I had tried RewriteRule ^product/([0-9]+)$ product-details?detail-id=$1 but never worked. Most people on the internet are showing this when they are using links with query url in their href like this example '<a href="category.php?category-id=' . $category_value . ''

My Question How i put my code to Models and Controler Codeigniter4

i make navbar dinamic from my table i want to take my code view to models and controler but i stuck in there i just can created in my view
My code
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav mr-auto">
<?php
$db = \Config\Database::connect();
$builder = $db->table('navbar');
$navbar = $builder->where('parent_id', '0')->where('status', '1')->orderBy('id_nav', 'ASC')->get()->getResultArray();
?>
<?php foreach ($navbar as $menu) : ?>
<?php
$db = \Config\Database::connect();
$builder = $db->table('navbar');
$subnav = $builder->where('parent_id', $menu['id_nav'])->where('status', '1')->orderBy('id_nav', 'ASC')->get()->getResultArray();
?>
<?php if ($subnav != Null) : ?>
<?php foreach ($subnav as $nav) : ?>
<li class="nav-item dropdown active">
<a class="nav-link dropdown-toggle" href="#" id="dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><?= $menu['nav_name']; ?></a>
<div class="dropdown-menu" aria-labelledby="dropdown" style="border: 0px solid; background:#f8f9f9;">
<a class="dropdown-item" href="#"><?= $nav['nav_name']; ?></a>
</div>
</li>
<?php endforeach ?>
<?php else : ?>
<li class="nav-item active">
<a class="nav-link" href="#"><?= $menu['nav_name']; ?> <span class="sr-only">(current)</span></a>
</li>
<?php endif ?>
<?php endforeach ?>
</ul>
<form class="form-inline my-2 my-md-0">
<a class="navbar-brand" href="">
<button class="btn btn-sm btn-outline-danger my-2 my-sm-0" type="submit">LOGIN</button>
<button class="btn btn-sm btn-outline-success my-4 my-sm-0" type="submit">JOIN ME</button>
</a>
</form>
</div>
</div>
</nav>
code
My Question How i put my code to Models and Controler Codeigniter4
This might help you get started How to
Read the documentation it explains everything now that it was updated.
Moreover it seems that you do not have any idea what an MVC pattern is since you are loading the db in the view. I might start from there. Model-View-Controller

getVar() from selected option input codeigniter 4

I have view
<!-- input-text -->
<div class="form-group">
<?php $name = 'name';
$placeholder = 'Nama Lengkap';
$value = old($name); ?>
<label for="<?= $name; ?>"><?= $placeholder; ?></label>
<input type="text" class="form-control <?= ($validation->hasError($name)) ? "is-invalid" : ''; ?>" id="<?= $name; ?>" name="<?= $name; ?>" placeholder="<?= $placeholder; ?>" value="<?= $value ?>">
<div class="invalid-feedback">
<?= $validation->getError($name); ?>
</div>
</div>
<!-- input-select -->
<div class="form-group">
<?php $name = 'gender';
$placeholder = 'Jenis Kelamin';
$value = old($name); ?>
<label for="<?= $name; ?>"><?= $placeholder; ?></label>
<select name="<?= $name; ?>" class="selectpicker form-control" data-live-search="true" id="<?= $name; ?>">
<option value="0">Laki-laki</option>
<option value="1">Perempuan</option>
</select>
</div>
and controller
public function create(){
dd($this->request->getVar());}
it show only name, but gender doesn't. How to show the value of selected option in CodeIgniter 4?
when you try to catch your post in controller u should type the name variable of the input
public function create(){
dd($this->request->getVar('gender'));
}
Use form helper, try it:
<div class="form-group">
<label for="name">Nama Lengkap</label>
<?php echo form_input('name', set_value('name'), 'class="form-control" placeholder="Nama Lengkap"'); ?>
<?php if(!empty($errors)){ ?>
<em class="text-danger"><?php echo $errors->getError('name') ?></em>
<?php } ?>
</div>
<div class="form-group">
<label for="gender">Jenis Kelamin</label>
<?php echo form_dropdown('gender', ['0' => 'Laki-laki', '1' => 'Perempuan'], [], 'class="form-control"'); ?>
</div>
Hope it helpful, cheers...

Osclass Drop-down selection for city at search insted of category selection

the script is osclasss
This is the original code
?php if ( osc_count_categories() ) { ?>
<div class="cell selector">
<?php osc_categories_select('sCategory', null, __('Select a category', 'bender')) ; ?>
</div>
<div class="cell reset-padding">
<?php } else { ?>
<div class="cell">
<?php } ?>
<button class="ui-button ui-button-big js-submit"><?php _e("Search", 'bender');?></button>
</div>
How can I edit this code to make the user select a city for search not a category ?
Thank you everyone.
I found the solution =)
Thanks to https://stackoverflow.com/users/3465265/key
Just add this code
<?php $aCities = City::newInstance()->listAll(); ?>
<?php if(count($aCities) > 0 ) { ?>
<select name="sCity" id="sCity">
<option value=""><?php _e('Select a city...')?></option>
<?php foreach($aCities as $city) { ?>
<option value="<?php echo $city['s_name'] ; ?>"><?php echo $city['s_name'] ; ?></option>
<?php } ?>
</select>
<?php } ?>

How to display 5 columns per row in Opencart?

How to display 5 columns per row in opencart?
What I have tried is Extensions -> Modules ->Featured then edit the module. I have changed the limit to 5 and decreased the width and height but after changing it displays the same. I am not able to get five columns per row. Please suggest me how to acheve it.
Thank you.
Here is my popular.tpl file in catalog/view/theme/promoglasses/template/module
<div class="tab-title">
<h2>Popular Products</h2>
<ul class="tabs tabs-popular-products tab_categorys">
<li class="active" rel="tab129-popular-products">POPULAR Products</li>
</ul>
</div>
<br />
<br />
<br />
<div class="row">
<?php foreach ($products as $product) { ?>
<div class="product-layout col-sm-5ths">
<div class="product-thumb transition">
<div class="image"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" title="<?php echo $product['name']; ?>" class="img-responsive" /></div>
<div class="caption">
<h4><?php echo $product['name']; ?></h4>
<div class="label-cont"> As low as </div>
<div class="label-price">
<?php if ($product['price']) { ?>
<p class="price">
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-new"><?php echo $product['special']; ?></span> <span class="price-old"><?php echo $product['price']; ?></span>
<?php } ?>
<?php if ($product['tax']) { ?>
<?php } ?>
</p>
<?php } ?>
</div>
<div class="label-sup">
<b>
<sup>(C)</sup>
</b>
</div>
<br />
<p><?php echo $product['description']; ?></p>
<?php if ($product['rating']) { ?>
<div class="rating">
<?php for ($i = 1; $i <= 5; $i++) { ?>
<?php if ($product['rating'] < $i) { ?>
<span class="fa fa-stack"><i class="fa fa-star-o fa-stack-2x"></i></span>
<?php } else { ?>
<span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i></span>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
</div>
</div>
</div>
<?php } ?>
</div>
For the CSS part here I have written the code for class col-sm-5ths:
.col-sm-5ths {
float: left;
width: 20%;
min-height: 1px;
position: relative;
}

Resources