Skip to content

Instantly share code, notes, and snippets.

View carlaizumibamford's full-sized avatar
💭
I may be slow to respond.

CARLA I. BAMFORD carlaizumibamford

💭
I may be slow to respond.
View GitHub Profile
<?php
query_posts("posts_per_page=3&cat=5&paged=".$paged); ?>
<?php if ( have_posts () ) : while (have_posts()):the_post(); ?>
<?php endwhile; ?>
///Pagination code here.
<?php else : ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
<?php
if ( get_query_var('paged') ) { $paged = get_query_var('paged'); }
elseif ( get_query_var('page') ) { $paged = get_query_var('page'); }
else { $paged = 1; }
query_posts("posts_per_page=3&cat=5&paged=".$paged); ?>
<?php if ( have_posts () ) : while (have_posts()):the_post(); ?>
<?php endwhile; ?>
///Pagination code here.
<?php else : ?>
<?php endif; ?>
@carlaizumibamford
carlaizumibamford / Solving MySQL Database Issues 1
Last active March 14, 2022 16:50
Debugging When Establishing A MySQL Database
<?php
$con = mysql_connect('localhost', 'root', '1234');
if (!$con) {
exit('Cannot connect database.');
}
$result = mysql_select_db('phpdb', $con);
if (!$result) {
exit('Cannot select database.');
}
$result = mysql_query('SET NAMES utf8', $con);
@carlaizumibamford
carlaizumibamford / How to change the default charset to UTF-8 on XAMMP (PHP)
Last active August 29, 2015 14:08
How to change the default charset to UTF-8 on XAMMP (PHP)
1. Open "php.ini" in "C:\xampp\php\" directory.
2. Enable the following codes by removing ";".
;mbstring.language = Japanese
;mbstring.internal_encoding = EUC-JP
;mbstring.http_input = auto
;mbstring.http_output = SJIS
;mbstring.encoding_translation = Off
;mbstring.detect_order = auto
;mbstring.substitute_character = none
@carlaizumibamford
carlaizumibamford / How to change the default charset to UTF-8 on XAMMP (MySQL)
Created November 10, 2014 21:06
How to change the default charset to UTF-8 on XAMMP (MySQL)
1. Open "my.ini" in "C:\xampp\mysql\bin\" directory.
2. Edit the following lines.
# Add the following code before [client].
default-character-set=utf8
# Add the following code before [mysqld].
character-set-server=utf8
skip-character-set-client-handshake
@carlaizumibamford
carlaizumibamford / Conditional tag for multiple pages (Wordpress)
Last active February 2, 2022 22:53
Wordpress conditional tag for multiple pages
<?php if( is_page('PAGE ID') || is_page('PAGE ID') || is_page('PAGE ID') ): ?>
<?php endif; ?>
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.sample\.com
RewriteRule ^(.*)$ http://sample.com/$1 [R=301,L]
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^sample\.com
RewriteRule ^(.*)$ http://sample.com/$1 [R=301,L]
<?php if( !post_password_required( $post->ID ) ) : ?>
<?php else: ?>
<?php echo get_the_password_form(); ?>
<?php endif;?>
@carlaizumibamford
carlaizumibamford / Resolving Jquery Conflicts (Before)
Created February 2, 2022 23:10
Resolving Jquery Conflicts (Before)
&lt;?php $(document).ready(function(){
// insert coding here
}); ?&gt;