<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>KnowTeBook - Webworkers Daily Milk &#187; hacks</title>
	<atom:link href="http://www.knowtebook.com/tag/hacks/feed" rel="self" type="application/rss+xml" />
	<link>http://www.knowtebook.com</link>
	<description>A community blog about design, ideas, trends, wordpress &#38; more.</description>
	<pubDate>Sun, 11 Dec 2011 13:58:34 +0000</pubDate>
	<generator>http://wordpress.org/?v=9</generator>
	<language>en</language>
			<item>
		<title>Wordpress: How to use one installation for multiple Domains</title>
		<link>http://www.knowtebook.com/wordpress-how-to-use-one-installation-for-multiple-domains-910.htm</link>
		<comments>http://www.knowtebook.com/wordpress-how-to-use-one-installation-for-multiple-domains-910.htm#comments</comments>
		<pubDate>Fri, 11 Apr 2008 16:56:51 +0000</pubDate>
		<dc:creator>Knowtebook</dc:creator>
		
		<category><![CDATA[coding]]></category>

		<category><![CDATA[how-to]]></category>

		<category><![CDATA[tutorials]]></category>

		<category><![CDATA[wordpress]]></category>

		<category><![CDATA[hacks]]></category>

		<guid isPermaLink="false">http://www.knowtebook.com/?p=910</guid>
		<description><![CDATA[When it comes to an open source blogging software, Wordpress builds the ultimative tool for me. If you get used to Wordpress you will love it and use it at other projects as well. I have 7 wordpress sites und (...)]]></description>
			<content:encoded><![CDATA[<p><a target="_blank" href="http://www.knowtebook.com/uploaded/2008/04/wp-20-button-trans.gif"><img class="alignleft size-full wp-image-911" style="float: left;" title="Wordpress Logo" src="http://www.knowtebook.com/uploaded/2008/04/wp-20-button-trans.gif" alt="wp-20-button-trans Wordpress: How to use one installation for multiple Domains" width="200" height="55" /></a>When it comes to an open source blogging software, Wordpress builds the ultimative tool for me. If you get used to <a href="http://wordpress.org/" target="_blank">Wordpress</a> you will love it and use it at other projects as well. I have 7 wordpress sites und it gets difficult to keep all of them updated, since so many new features get out everytime. The best way to keep track of all wordpress sites would be <a target="_blank" href="http://mu.wordpress.org" target="_blank">Wordpress MU</a>, but it is kind of to big scaled for most of us. Now, which other solutions may help? I found a <a target="_blank" href="http://wordpress.org/support/topic/81002?replies=21#post-424982" target="_blank">note by lunabyte in the wordpress forums</a> how to use the standard Wordpress installation with multiple Domains. I hope you will enjoy it and report your experiences with it.</p>
<p>If you have worked out your own idea, please please keep us informed so we can improve this knowte by <em>lunabyte</em> to an a-class how-to!<span id="more-910"></span></p>
<blockquote><p>Lunabyte: I started messing around a couple hours ago with this. In short: It works, beautifully. I&#8217;ll try to keep this as short as possible. Here&#8217;s what I did.</p>
<h2>The set-up:</h2>
<p>I used three domains for this experiment. We&#8217;ll say md1.tld, md2.tld, and md3.tld. All three domains point to the root public html directory.</p>
<h2>The process:</h2>
<h3>1) Installed wordpress.</h3>
<p>WordPress extracts to a &#8220;wordpress&#8221; directory. I didn&#8217;t feel like moving all the files up a level, so I simply renamed the directory to another name (I used &#8220;media&#8221;, but whatever), and then moved the index.php file up a level. I have other stuff in the main directory, else I could have just did an mv, and made it the new root html dir. Anyway, for testing this worked out nice since it is different than a completely untouched install. I did the modification to index.php, to point it to the right place, and put a new index.php in the directory with all the core files that redirect to the one above. Next, I added the info to config.php, and installed as normal. I made a few minor changes to the default configuration in the admin panel, as I usually tend to do. These included: - changed site name to suit the purpose, and description, - as well as took out pingomatic (no need to ping with test posts), - as well as changed the permalinks to &#8220;/%category%/%postname%.html. I left the theme set on Kubrick, but I did upload another theme to use later. Changed my password. (important) Edited the default hello world, and comment. Left them, just changed the data. Did same for default &#8220;about&#8221; page too. Back into phpmyadmin, I edited the user table, and replaced the value &#8220;admin&#8221; in login and nicename to something different. Now that I have a workable default configuration, onto step 2.</p>
<h3>2) Dumped the current tables</h3>
<p>PhpMyAdmin, dumped the tables, saved them in a default local file. Made a copy, renamed it to Dump-md2, and then did a search/replace to find the original domain and replace it with the new one. Next, did a search for the original table prefix (i used &#8220;md1___&#8221;) and replaced it with the new table prefix (&#8221;md2___&#8221;). Next, pasted it back into phpmyadmin, and it created just fine.</p>
<h3>3) Time to alter the config.</h3>
<p>Opened config.php to make the following changes. I will generalize them here, but you&#8217;ll get the idea. - above the db info, i added a 4 sequence if/elseif statement. I used 2 stristr functions, and checked the $_SERVER variables HTTP_HOST, and X_FORWARDED_HOST for &#8220;md1.tld&#8221;. If it returns true, I set a variable to equal the table prefix for md1 ( $tbl_xtest = md1___ ) Then added two elseif statements to the sequence, changed the domain i was looking for, and the resulting table prefix. The final check in the sequence was a plain old else, which set the table prefix variable to the one i wanted as a default. I used the first one. Next, the line where it actually sets the table prefix, I removed &#8216;wp_&#8217; and replaced it with $tbl_xtest.</p>
<h3>4) Testing</h3>
<p>I uploaded the new config file, and checked the initial domain. Check 1. I checked the second domain. It worked flawlessly. The third was just fine too. Now, time to see what happens if I use a domain not listed. Bam. It was the default site, just as it should be. I logged into the second site, and made a few changes. (Note, with the duplicated tables, your username/pass is the same.) I changed the theme to the one uploaded earlier, and some other things. All were seamless. It was no different than it being two installs. In summary, it worked just fine. Now for some notes&#8230;</p>
<h2>Plugins:</h2>
<p>Some may or may not work. In theory, most should. Ones that would not, are ones that create tables in the DB, but don&#8217;t use the table prefix. I&#8217;ve seen a couple that have done this, at least they did at the point I used them. wp-cache? Don&#8217;t know, don&#8217;t use it. Themes should be ok. As long as it keeps in line with table prefixes, and the site url/file settings, all should be ok. Don&#8217;t take my word for it though, as I said, I haven&#8217;t tested any plugins. There might be an issue with plugins that want to modify the htaccess file. Look at what it wants to do, and edit it manually to be safe. There shouldn&#8217;t be a problem with multiple conditions for different domains, but you never know.</p>
<h2>Themes:</h2>
<p>Should be fine. Since they are activated in each DB, and follow the settings that are set in the options pages. I should note, that any theme customization for a particular domain should be made into a theme identifiable for that domain. I wouldn&#8217;t recommend allowing the theme files to be writable, just in case.</p>
<h2>Permalinks:</h2>
<p>Since they are controlled by the database, all is well.</p>
<h2>Final Note:</h2>
<p>This was a test, simply to prove that it can be done. I&#8217;m not supporting my changes, only showing you how. This is by far not an option for a novice or noob, that can barely figure out where to edit the style sheet for Kubrick to change the color of the links or header image. If you don&#8217;t know php, and that does not mean being able to cut and paste a tag it means KNOW php, then don&#8217;t try this at home folks. If you have a test site, then feel free to experiment until your hearts content. Just remeber, I&#8217;m not responsible for anyone messing something up, and all that jazz. <img src='http://www.knowtebook.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' title="icon wink Wordpress: How to use one installation for multiple Domains   coding" /> Have fun.</p></blockquote>]]></content:encoded>
			<wfw:commentRss>http://www.knowtebook.com/wordpress-how-to-use-one-installation-for-multiple-domains-910.htm/feed</wfw:commentRss>
	<enclosure url='http://www.knowtebook.com/uploaded/2008/04/wp-20-button-trans-150x55.gif' length ='1'  type='image/jpeg' />	</item>
		<item>
		<title>Wordpress: Shorten the title of posts or everything else you want</title>
		<link>http://www.knowtebook.com/wordpress-shorten-the-title-of-posts-or-everything-else-you-want-872.htm</link>
		<comments>http://www.knowtebook.com/wordpress-shorten-the-title-of-posts-or-everything-else-you-want-872.htm#comments</comments>
		<pubDate>Tue, 25 Mar 2008 12:41:12 +0000</pubDate>
		<dc:creator>Knowtebook</dc:creator>
		
		<category><![CDATA[how-to]]></category>

		<category><![CDATA[tutorials]]></category>

		<category><![CDATA[wordpress]]></category>

		<category><![CDATA[hacks]]></category>

		<guid isPermaLink="false">http://www.4webworking.com/wordpress-shorten-the-title-of-posts-or-everything-else-you-want-895.htm</guid>
		<description><![CDATA[In a recent project I needed a section with short notes (common as asides) and a list of posts in the sidebar. The problem was only, that the length of the posttitle was to long for my theme and my (...)]]></description>
			<content:encoded><![CDATA[<p>In a recent project I needed a section with short notes (common as asides) and a list of posts in the sidebar. The problem was only, that the length of the posttitle was to long for my theme and my layout suffered under this small bug. I also didnt wanted to change the wordpress core files which might be replaced by updates in future. So I wrote a solution for this and am sharing it to the public. Alle additions are only to make in your theme. Use it for everything you want, just let the note intact or link back to this site.</p>
<p><strong>Now, lets get ready:</strong></p>
<p>Create or open the functions.php in your wordpress templates folder. We will add a function which makes all the work for us everytime we will need it.</p>
<p><span id="more-872"></span></p>
<p><strong>FIND</strong></p>
<pre>&lt;?php</pre>
<p><strong>ADD BENEATH</strong></p>
<pre>// Wordpress Hack by Knowtebook.com
// Shorten any text you want

function ShortenText($text)

{

// Change to the number of characters you want to display

$chars_limit = 100;

$chars_text = strlen($text);

$text = $text." ";

$text = substr($text,0,$chars_limit);

$text = substr($text,0,strrpos($text,' '));

// If the text has more characters that your limit,
//add ... so the user knows the text is actually longer

if ($chars_text &gt; $chars_limit)

{

$text = $text."...";

}

return $text;

}</pre>
<p>Now we add a little code to the place within the loop for example to cut the title. It will call the function and short the title. Take attention to the title function: get_the_title() instead of the_title(), because the_title() would give out the title directly.</p>
<p><strong>FIND</strong></p>
<pre>&lt;?php the_title(); ?&gt;</pre>
<p><strong>REPLACE WITH</strong></p>
<pre>&lt;?php echo ShortenText(get_the_title()); ?&gt;</pre>
<p>You can use this for any text to shorten. You just have to double the function and give it a new name, so you can have different character limits.</p>
<p>Have fun and share!</p>]]></content:encoded>
			<wfw:commentRss>http://www.knowtebook.com/wordpress-shorten-the-title-of-posts-or-everything-else-you-want-872.htm/feed</wfw:commentRss>
		</item>
	</channel>
</rss>

