Migrating a WordPress site to new url or domain, live or to a production/development server, new URL strings in the mySql database need to be changed and updated in various database tables.
This method is work when you like to move whole mysql database via phpmyadmin instead export/import all within wordpress admin. So you would copy/move all wordpress files/folder to new destination, set the correct ownership to those files and than start work on database.
Old url to New url change within phpmyadmin
Export database from old server.
Create a new blank database on New Server
Import old database via phpmyadmin import wizard
Use the code as below in sql query and change in your old and new URLs, no trailing slashes.
UPDATE wp_options SET option_value = replace(option_value, 'http://www.old.url', 'http://www.new.url') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.old.url','http://www.new.url');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old.url', 'http://www.new.url');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.old.url','http://www.new.url');
Finally update wordpress config file to reflect the new database, “wp-config.php” should be in your web document root – change, database name, ursername, password and host values:
define('DB_NAME', ‘dbname');
/** MySQL database username */
define('DB_USER', 'username');
/** MySQL database password */ d
efine('DB_PASSWORD', 'password');
/** MySQL hostname */
define('DB_HOST', 'localhost');
For a clients website I need to remove post info for multiple categories. So, here is the code I use to remove genesis_post_info from multiple categories.
Add above code to the bottom of your child theme’s functions.php file.
https://i0.wp.com/www.areuconnected.com/wp-content/uploads/2011/11/web-design1.png?fit=355%2C243&ssl=1243355Jabed Shoebhttps://www.areuconnected.com/wp-content/uploads/2023/05/areuconnected-logo.pngJabed Shoeb2011-11-22 15:35:292011-11-22 15:35:29Removing genesis post_info from a Single or multiple Category
For a client’s blog website I need to add a para automatically after each single post, found a snippet from Jeff Starr using a WordPress hook. Here’s how to do.
https://i0.wp.com/www.areuconnected.com/wp-content/uploads/2011/09/custom_content1.jpg?fit=350%2C340&ssl=1340350Jabed Shoebhttps://www.areuconnected.com/wp-content/uploads/2023/05/areuconnected-logo.pngJabed Shoeb2011-09-23 03:46:132011-09-23 03:46:13Insert custom content after single post
So, since Genesis 1.6, and probably my favorite part of Genesis 1.6 is the theme support of genesis-structural-wraps. So now you can easily add wraps to the header, nav, subnav, inner, footer-widgets, and footer. If you’ve ever looked at the Visual Markup Guide for the Genesis Framework, you may have noticed that all of the main sections contain a div that wraps around the inner markup except the the ‘inner’ section. Have a look at this:
#header > .wrap
#nav > .wrap
#subnav > .wrap
#inner > .wrap, this is what we will be adding
#footer-widgets >.wrap
#footer > .wrap
Previously to add an #inner wrap, for example, you had to: // Add div.wrap inside of div#inner
function child_before_content_sidebar_wrap() {
echo '<div class="wrap">';
}
add_action('genesis_before_content_sidebar_wrap', 'child_before_content_sidebar_wrap');
function child_after_content_sidebar_wrap() {
echo '</div><!-- end .wrap -->';
}
add_action('genesis_after_content_sidebar_wrap', 'child_after_content_sidebar_wrap');
Genesis has made it easy for us to add the additional wrapper by using hooks. All you need to do is open up the functions.php file in your child theme and add the following code. The code should be placed at the end of the file, just before the closing ?> if there is one. add_theme_support( 'genesis-structural-wraps', array( 'header', 'nav', 'subnav', 'inner', 'footer-widgets', 'footer' ) );
The style changes
By default the sample child theme for genesis is boxed in a 960px #wrap that constrains all the elements inside to that width centering them on the page. Find #wrap in your sample child theme style.css around line 162.
Change: #wrap {
background-color: #fff;
margin: 0 auto 10px;
width: 960px;
}
to: #wrap {
background-color: #fff;
}
This will remove the contraint and allow our elements inside to span as far as we please.
Add styles for the wrap divs that is inside each our main div structures. This style will set each area to 960px width with the margin:0 auto; centering them on the page. .wrap {
margin: 0 auto;
width: 960px;
} NOTE: Can be more specific to each area by adding the id of each section before .wrap for example: #nav .wrap { width: 900px; } Will set the nav to be shorter than the other areas.
Find each main structural div and remove its width. The width we set for .wrap will handle this. Search for #header, #nav, #subnav, #inner, #footer-widgets & #footer and remove the width set for each.
Hope this will help you to make your theme more better. 🙂
https://i0.wp.com/www.areuconnected.com/wp-content/uploads/2011/07/Genesis-framework-design-tips.jpg?fit=805%2C250&ssl=1250805Jabed Shoebhttps://www.areuconnected.com/wp-content/uploads/2023/05/areuconnected-logo.pngJabed Shoeb2011-08-02 12:40:412014-01-27 14:29:05How to Add an Additional Wrap on Genesis Child Theme
Sometimes I need to get footer outside of wrap. I tried to find out how can i do that in genesis child theme. This code I got first from Marco who got it from Daisy Olsen.
Sometimes need to change the Genesis‘s default content on demand of client to show clients requirement (i.e. footer logo, remove back to top, credential change, add footer link).
NOTE: When writing your own code/filters, use a child theme. Do not write to the default functions.php file in Genesis. It will overwrite on updates.
See below for codes I wrote to change Genesis Footer Content on child themes.
This will remove the footer credits text and ‘back to top’ link. add_filter('genesis_footer_output', 'footer_output_filter', 10, 1);
function footer_output_filter($footer_content) {
$footer_content = '';
return $footer_content;
}
There’s a lot of small code snippets I use often. This is where I’ll collect them. If you have any quick tips, feel free to share in the comments.
Force a page layout
This is very useful for ensuring custom pages you build for a client aren’t broken by them changing the page layout (ex: home page). Or, changing the page layout to something other than the default on archive pages (ex: category). The example below is to set the category page to Sidebar-Content-Sidebar.
// Force layout on category
add_filter('genesis_pre_get_option_site_layout', 'child_category_layout');
function child_category_layout($opt) {
if ( is_category() )
$opt = 'sidebar-content-sidebar';
return $opt;
}
Set default page layout // Register default site layout option
genesis_set_default_layout( 'full-width-content' );
Setup the child theme
This is what I include at the top of my functions.php file in my child themes. Any time below you see an add_action or add_filter, that part goes in the setup function, and the function itself goes after the setup function. // Start the engine
require_once(TEMPLATEPATH.'/lib/init.php');
// Setup the child theme
add_action('after_setup_theme','child_child_theme_setup');
function child_child_theme_setup() {
// ** Backend **
// Remove Purchase Themes menu link from dashboard
remove_theme_support('genesis-purchase-menu');
// ** Frontend **
}
Add Image Sizes
This adds an image size named ‘feature’ with a fixed size of 600×250. See Mark Jaquith’s post for details. add_image_size('feature', 600, 250, true);
Modify Post Info
Shortcode Reference add_filter('genesis_post_info', 'child_post_info_filter');
function child_post_info_filter($post_info) {
$post_info = '[ post_date ] by [ post_author_posts_link ] at [ post_time ] [ post_comments ] [ post_edit ]';
return $post_info;
}
Remove Post Info remove_action('genesis_before_post_content', 'genesis_post_info');
Modify Post Meta add_filter('genesis_post_meta', 'child_post_meta_filter');
function child_post_meta_filter($post_meta) {
$post_meta = '[ post_categories ] Tagged with [ post_tags ]';
return $post_meta;
}</code>
<strong>Remove Post Meta</strong>
<code>remove_action('genesis_after_post_content', 'genesis_post_meta'); Change Excerpt More text […]
function child_excerpt_more($more) {
return '[.....]';
}
add_filter('excerpt_more', 'child_excerpt_more');
This is useful if you want to use the default site title (Settings > Title) but style different elements of it differently. This specific code searches for “of” in the site title, and changes it to <em>of</em>. // Customize the site title
add_filter('genesis_seo_title','child_customize_site_title', 10, 3);
function child_customize_site_title($title, $inside, $wrap) {
$custom = str_replace("of", "<em>of</em>", $title);
return $custom;
}
Customize the Site Description (in #header) add_filter('genesis_seo_description','child_customize_site_description', 10, 3);
function child_customize_site_description($description, $inside, $wrap) {
$custom = str_replace("Redefining", "<strong>Redefining</strong>", $description);
return $custom;
}
Remove the Post Title // Remove Post Title
remove_action('genesis_post_title','genesis_do_post_title');
To add a description to a menu item, go to Appearances > Menus. At the top right click “Screen Options”, then check “Description”. Now you can click the dropdown arrow next to menu items and add a description. The below code will make it visible on the site. // Display Description of Menu Items
add_filter( 'walker_nav_menu_start_el', 'child_add_description', 10, 2 );
function child_add_description( $item_output, $item ) {
$description = __( $item->post_content );
return preg_replace( '/(<a.*?>[^<]*?)</', '$1' . '<span >' . $description . '</span></', $item_output);
}
Register a Sidebar genesis_register_sidebar(array(
'name'=>'Homepage Widgets',
'id' => 'homepage-widgets',
'description' => 'This shows up at the bottom of the homepage.',
));
Unregister a Sidebar unregister_sidebar('sidebar-alt');
Customize Read More Link // Customize Read More Link
add_filter( 'excerpt_more', 'child_more_link' );
add_filter( 'get_the_content_more_link', 'child_more_link' );
add_filter( 'the_content_more_link', 'child_more_link' );
function child_more_link($more_link, $more_link_text) {
return sprintf('%s', get_permalink(), 'Read More');
}
This website only uses cookies that are necessary for the site to function and they do not contain any personal data. You can find out more about the cookies used in our privacy policy
We may request cookies to be set on your device. We use cookies to let us know when you visit our websites, how you interact with us, to enrich your user experience, and to customize your relationship with our website.
Click on the different category headings to find out more. You can also change some of your preferences. Note that blocking some types of cookies may impact your experience on our websites and the services we are able to offer.
Essential Website Cookies
These cookies are strictly necessary to provide you with services available through our website and to use some of its features.
Because these cookies are strictly necessary to deliver the website, you cannot refuse them without impacting how our site functions. You can block or delete them by changing your browser settings and force blocking all cookies on this website.
Google Analytics Cookies
These cookies collect information that is used either in aggregate form to help us understand how our website is being used or how effective our marketing campaigns are, or to help us customize our website and application for you in order to enhance your experience.
If you do not want that we track your visist to our site you can disable tracking in your browser here:
Other external services
We also use different external services like Google Webfonts, Google Maps and external Video providers. Since these providers may collect personal data like your IP address we allow you to block them here. Please be aware that this might heavily reduce the functionality and appearance of our site. Changes will take effect once you reload the page.
Google Webfont Settings:
Google Map Settings:
Vimeo and Youtube video embeds:
Privacy Policy
You can read about our cookies and privacy settings in detail on our Privacy Policy Page.