<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>vue Archives - Michael Soriano</title>
	<atom:link href="https://michaelsoriano.com/tag/vue/feed/" rel="self" type="application/rss+xml" />
	<link>https://michaelsoriano.com/tag/vue/</link>
	<description>I turn code into captivating user experiences for the web</description>
	<lastBuildDate>Wed, 14 Feb 2024 17:54:07 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.4</generator>
	<item>
		<title>New WordPress Starter Theme using VueJS</title>
		<link>https://michaelsoriano.com/wordpress-starter-theme-using-vuejs/</link>
					<comments>https://michaelsoriano.com/wordpress-starter-theme-using-vuejs/#comments</comments>
		
		<dc:creator><![CDATA[Michael Soriano]]></dc:creator>
		<pubDate>Sat, 17 Feb 2018 19:21:18 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[vue]]></category>
		<guid isPermaLink="false">http://michaelsoriano.com/?p=6447</guid>

					<description><![CDATA[<p>I&#8217;ve been building WordPress themes for quite some time now. And with the advent of front-end frameworks and WP&#8217;s REST API, I thought it would be a good combination to build one that uses both. The benefits would be that the site&#8217;s user experience would be lightning fast. There wouldn&#8217;t be server page loads (except [&#8230;]</p>
<p>The post <a href="https://michaelsoriano.com/wordpress-starter-theme-using-vuejs/">New WordPress Starter Theme using VueJS</a> appeared first on <a href="https://michaelsoriano.com">Michael Soriano</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>I&#8217;ve been building WordPress themes for quite some time now. And with the advent of front-end frameworks and WP&#8217;s REST API, I thought it would be a good combination to build one that uses both. The benefits would be that the site&#8217;s user experience would be lightning fast. There wouldn&#8217;t be server page loads (except for the first one). </p>



<p>So all subsequent navigation will be done in the client side. This results to a smoother and better user experience.</p>



<p class="btn"><a href="https://github.com/michaelsoriano/wp-vue-starter">View in Github</a></p>



<p>I wanted to build several themes, but would like a base theme to start with. Enter <strong>wp-vue-starter. </strong>A starter theme that is built on a popular framework called Vue, and WP&#8217;s REST API in the background.</p>



<p><br><img fetchpriority="high" decoding="async" width="850" height="332" class="alignnone size-full wp-image-6451" src="https://michaelsoriano.com/wp-content/uploads/2018/01/wp-vue.jpg" alt="wp vue logos" srcset="https://michaelsoriano.com/wp-content/uploads/2018/01/wp-vue.jpg 850w, https://michaelsoriano.com/wp-content/uploads/2018/01/wp-vue-300x117.jpg 300w, https://michaelsoriano.com/wp-content/uploads/2018/01/wp-vue-768x300.jpg 768w" sizes="(max-width: 850px) 100vw, 850px" /></p>



<p>Note that since all of the rendering is done in the client, SEO is not going to be available. But for sites that SEO will not matter, I think this is a good choice. Let me explain the theme design and structure and maybe you can use the theme in your next project.</p>



<h3 class="wp-block-heading">Traditional Blog Design</h3>



<p>If you do a search on WordPress Theme and Vue, there have been many attempts on it. This however, is slightly different. First of all, is the design. It uses the traditional blog design that many of us WordPress users have grown to like.</p>



<p>Here is a screenshot of the homepage:</p>



<p><img decoding="async" width="850" height="960" class="alignnone size-full wp-image-6448" src="https://michaelsoriano.com/wp-content/uploads/2018/01/home-page.png" alt="home" srcset="https://michaelsoriano.com/wp-content/uploads/2018/01/home-page.png 850w, https://michaelsoriano.com/wp-content/uploads/2018/01/home-page-266x300.png 266w, https://michaelsoriano.com/wp-content/uploads/2018/01/home-page-768x867.png 768w" sizes="(max-width: 850px) 100vw, 850px" /><br></p>



<p>As you can see, it has a &#8220;static&#8221; page that is called &#8220;home&#8221;. There is a big area (jumbotron) for your carousel or hero image, while the latest posts are directly below it. The CSS framework is Bootstrap (version 4). So editing the grid and elements is familiar to many. A sidebar is built in &#8211; which is pretty standard to most sites.</p>



<p>What is a site without &#8220;Search&#8221;. That of course is also included. A search form is in the header, and is a component called &#8220;search-form&#8221;. So this component can be used in the sidebar, footer &#8211; where ever you want the form to be.</p>



<p>The search results look look like below:</p>



<p><img decoding="async" width="850" height="1116" class="alignnone size-full wp-image-6449" src="https://michaelsoriano.com/wp-content/uploads/2018/01/search-results.png" alt="search template" srcset="https://michaelsoriano.com/wp-content/uploads/2018/01/search-results.png 850w, https://michaelsoriano.com/wp-content/uploads/2018/01/search-results-228x300.png 228w, https://michaelsoriano.com/wp-content/uploads/2018/01/search-results-780x1024.png 780w, https://michaelsoriano.com/wp-content/uploads/2018/01/search-results-768x1008.png 768w" sizes="(max-width: 850px) 100vw, 850px" /><br>Also notice the paging. The paging system is inside a component called &#8220;the-loop&#8221;. For many of us theme developers, the &#8220;Loop&#8221; is the basis of a template inside a theme. So I wanted to keep the same concept here. So you will see the &#8220;archive&#8221; and &#8220;search&#8221; is basically using &#8220;the-loop&#8221; component, because it shares the same properties.</p>



<h3 class="wp-block-heading">Single, Page and Comments Form</h3>



<p>The &#8220;single&#8221; post page is also a Vue component. This accessed using the slug:</p>



<p><strong>/post/post-name</strong></p>



<p>The &#8220;page&#8221; page is another component, and can be accessed by:</p>



<p><strong>/page/page-name</strong></p>



<p>So the urls are not exactly as the traditional WordPress urls, but is quite clean in my opinion. So you need to update your permalink structure in WordPress to <strong>/post/%postname%/:</strong></p>



<p><img decoding="async" width="959" height="259" class="alignnone size-full wp-image-6467" src="https://michaelsoriano.com/wp-content/uploads/2018/02/permalink.png" alt="permalink" srcset="https://michaelsoriano.com/wp-content/uploads/2018/02/permalink.png 959w, https://michaelsoriano.com/wp-content/uploads/2018/02/permalink-300x81.png 300w, https://michaelsoriano.com/wp-content/uploads/2018/02/permalink-768x207.png 768w" sizes="(max-width: 959px) 100vw, 959px" /></p>



<p>So you can still access most of the admin functionality such as viewing pages, posts and previewing.</p>



<p>Below is an example of the single page.</p>



<p><img decoding="async" width="850" height="2231" class="alignnone size-full wp-image-6450" src="https://michaelsoriano.com/wp-content/uploads/2018/01/single.png" alt="single template" srcset="https://michaelsoriano.com/wp-content/uploads/2018/01/single.png 732w, https://michaelsoriano.com/wp-content/uploads/2018/01/single-114x300.png 114w, https://michaelsoriano.com/wp-content/uploads/2018/01/single-390x1024.png 390w, https://michaelsoriano.com/wp-content/uploads/2018/01/single-768x2016.png 768w, https://michaelsoriano.com/wp-content/uploads/2018/01/single-585x1536.png 585w, https://michaelsoriano.com/wp-content/uploads/2018/01/single-780x2048.png 780w" sizes="(max-width: 850px) 100vw, 850px" /><br>In addition, to the content &#8211; is the comments. This theme is built with the comment responses and the form in it. It is pretty basic in design &#8211; very &#8220;Bootstrapy&#8221;. But again, this is a starter theme &#8211; so what do you expect.</p>



<h3 class="wp-block-heading">Theme Structure</h3>



<p>So if you&#8217;re going to use <strong>wp-vue-starter, </strong>chances are, you&#8217;re going to edit it. So let&#8217;s go over the structure briefly. Note that you need to know WordPress and Vue a little bit to dive into this.<br>Everything goes in through <strong>index.php. </strong></p>



<p>This is where your entire HTML wrapper is. From the opening HTML tag, header and footer is inside here. You will also see that all of the templates are included in this page as &#8220;template&#8221; tags.</p>



<p><img decoding="async" width="565" height="416" class="alignnone size-full wp-image-6469" src="https://michaelsoriano.com/wp-content/uploads/2018/02/indexphp.png" alt="index" srcset="https://michaelsoriano.com/wp-content/uploads/2018/02/indexphp.png 565w, https://michaelsoriano.com/wp-content/uploads/2018/02/indexphp-300x221.png 300w" sizes="(max-width: 565px) 100vw, 565px" /></p>



<p>This is also where the DIV called &#8220;<strong>app</strong>&#8221; is &#8211; so Vue is inserting the entire application into this DIV. The <strong>styles.css</strong> in the root is nothing but a marker. It just tells WordPress about the theme name and such.</p>



<p>There are actually no styles in here. Instead, the styles go into <strong>/css/dist/main.css</strong> The <strong>main.js </strong>is where all of the JavaScript logic is. This is where the components are declared, all of the methods as well the routing. If you want to change Vue or JS logic, this is the right file. Below shows a sample of the route mapping system.</p>



<p><img decoding="async" width="654" height="720" class="alignnone size-full wp-image-6471" src="https://michaelsoriano.com/wp-content/uploads/2018/02/routes.png" alt="routes" srcset="https://michaelsoriano.com/wp-content/uploads/2018/02/routes.png 654w, https://michaelsoriano.com/wp-content/uploads/2018/02/routes-273x300.png 273w" sizes="(max-width: 654px) 100vw, 654px" /></p>



<p>Normal WordPress functions go inside the <strong>functions.php</strong>. This is where you will see modifying REST responses and such. Note that by default, the theme is allowing anonymous comments &#8211; so you might want to change this.</p>



<p>Lastly, inside the &#8220;templates&#8221; folder &#8211; are the components. They&#8217;re PHP files, but there&#8217;s no PHP logic in them. I just left it like that for consistency &#8211; and just in case you want to add some PHP in it, you can. The files resemble a traditional WordPress theme. Like 404, page, single, search etc.</p>



<p><img decoding="async" width="515" height="550" class="alignnone size-full wp-image-6472" src="https://michaelsoriano.com/wp-content/uploads/2018/02/templates.png" alt="templates" srcset="https://michaelsoriano.com/wp-content/uploads/2018/02/templates.png 515w, https://michaelsoriano.com/wp-content/uploads/2018/02/templates-281x300.png 281w" sizes="(max-width: 515px) 100vw, 515px" /></p>



<p>Lastly, the &#8220;partials&#8221; are the files with the underscore prefix. So this the _header, _footer, _sidebar. Note that this &#8220;header&#8221; is the html header &#8211; not the &#8220;&lt;head>&#8221;.</p>



<h3 class="wp-block-heading">Installation</h3>



<p>Installation is the same as any other theme. Simply upload and activate (don&#8217;t forget to update the permalinks). You can also use SASS &#8211; for CSS preprocessing. This is included by default, and is the best way to edit CSS. The source files are inside /src and output is /dist.</p>



<p>Gulp is the default build tool, so you can run</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash"><strong>npm i -D gulp gulp-sass gulp-sourcemaps gulp-clean-css</strong></code></pre>



<p>For the SASS compiler and CSS clean up.</p>



<p>The theme is under MIT license, and is available in <a href="https://github.com/michaelsoriano/wp-vue-starter">GithHub</a>. I will be adding more features such as additional templates etc., so stay tuned.</p>
<p>The post <a href="https://michaelsoriano.com/wordpress-starter-theme-using-vuejs/">New WordPress Starter Theme using VueJS</a> appeared first on <a href="https://michaelsoriano.com">Michael Soriano</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://michaelsoriano.com/wordpress-starter-theme-using-vuejs/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
