first commit
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 65 KiB |
After Width: | Height: | Size: 8.9 KiB |
After Width: | Height: | Size: 69 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 83 KiB |
After Width: | Height: | Size: 111 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 61 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 9.1 KiB |
@ -0,0 +1,377 @@
|
||||
<?php
|
||||
|
||||
function pk_create_theme_docs_page() {
|
||||
|
||||
?>
|
||||
<style>
|
||||
.pk_help {
|
||||
font-size:14px;
|
||||
line-height:24px;
|
||||
}
|
||||
.pk_help ol li {
|
||||
margin-bottom:30px;
|
||||
}
|
||||
small {
|
||||
font-weight:bold;
|
||||
}
|
||||
pre {
|
||||
color:#444;
|
||||
background-color:#eee;
|
||||
padding:20px;
|
||||
padding-bottom:0px;
|
||||
}
|
||||
</style>
|
||||
<div class="wrap">
|
||||
<div id="icon-options-general" class="icon32"><br /></div>
|
||||
<h2>Theme Docs</h2>
|
||||
<br />
|
||||
<div class="pk_help">
|
||||
<h1 id="docs_table_of_contents">Table of contents:</h1>
|
||||
<ul>
|
||||
<li><a href="#demo_contents_installation">Demo Contents Installation</a></li>
|
||||
<li><a href="#important_infos">Important Infos</a></li>
|
||||
<li><a href="#supported_plugins">Supported Plugins</a></li>
|
||||
<li><a href="#theme_options">Theme Options</a></li>
|
||||
<li><a href="#navigation_menus_setup">Navigation Menus Setup</a></li>
|
||||
<li><a href="#home_page_setup">Home Page Setup</a></li>
|
||||
<li><a href="#blog_setup">Blog Setup</a></li>
|
||||
<li><a href="#portfolio_setup">Portfolio Setup</a></li>
|
||||
<li><a href="#creating_pages">Creating Pages</a></li>
|
||||
<li><a href="#creating_blog_posts">Creating Blog Posts</a></li>
|
||||
<li><a href="#creating_works">Creating Works</a></li>
|
||||
<li><a href="#page_templates">Page Templates</a></li>
|
||||
<li><a href="#formats">Formats</a></li>
|
||||
<li><a href="#the_home_page_templates_slider">The Home Page Templates Slider</a></li>
|
||||
<li><a href="#sidebars_and_widgets_areas">Sidebars and Widgets Areas</a></li>
|
||||
<li><a href="#the_html_generator">The HTML Generator</a></li>
|
||||
<li><a href="#theme_translation">Theme Translation</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<br />
|
||||
<small><a href="#docs_table_of_contents">^ Back to menu ^</a></small><span id="demo_contents_installation"></span>
|
||||
<h1>Demo Contents Installation</h1>
|
||||
<p>The demo contents installation explained in this video refers to the official theme's preview that you can see here: <a href="http://sold.parkerandkent.com/sold/" target="_blank">WordPress Sold! Responsive/E-Commerce Theme </a>.</p>
|
||||
<p>For the official preview we have used <strong>JigoShop</strong> to build the store. The support of the <strong>WooCommerce</strong> plugin has been added later, so if you intend to use <strong>WooCommerce</strong> just follow the same steps explained for <strong>JigoShop</strong>. Only for WooCommerce: once you've set up the plugin and the demo contents you will need to update each product post in order to add them to the shop. This step is necessary because, for the theme's preview, the products have been created with JigoShop and so they need to be saved for WooCommerce. Also the home page for the ecommerce needs to be updated: instead of the <strong>Home Page JigoShop Template</strong> you need to assign the <strong>Home Page WooCommerce Template</strong> to it and save/update.</p>
|
||||
<p>The <strong>sold.xml</strong> file of the demo contents is pretty huge, considering the amount of contents showcased on the preview. In some cases the import of this file can take several minutes, depending on your server performances. <strong>We suggest to import the demo contents only to localhost installations (using MAMP, XAMP or similar applications).</strong></p>
|
||||
<p><iframe src="http://www.screenr.com/embed/DTe8" width="650" height="396" frameborder="0"></iframe></p>
|
||||
|
||||
|
||||
<br />
|
||||
<small><a href="#docs_table_of_contents">^ Back to menu ^</a></small><span id="important_infos"></span>
|
||||
<h1>Important Infos</h1>
|
||||
<ol>
|
||||
<li><strong>Read the docs</strong> and, if you've never used WordPress before, this must be your <a href="http://codex.wordpress.org/Main_Page" target="_blank">starting point</a>.</li>
|
||||
<li>Every time you save a page, post or work <small>(depending on the selected format or page template)</small> an <strong>options panel</strong> will appear below the text editor of the post. <strong>So, first select the format or template, enter a title and then save. Only then the options panel will appear.</strong></li>
|
||||
<li>Every page, post or work featuring a <strong>gallery</strong>, a <strong>slider</strong> or an <strong>image</strong> uses post's <a href="http://codex.wordpress.org/Inserting_Images_into_Posts_and_Pages" target="_blank">attachments</a>. So, for these post formats, just upload your images as post's attachments and enjoy. For more detailed info don't miss the next sections about <a href="#page_templates">page templates</a> and <a href="#formats">formats</a>.</li>
|
||||
<li>Below the text editor of each page, post or work there is the <strong>HTML Generator</strong>, to generate contents like buttons, pricing tables, boxes, accordions, toggles, etc. Remember to use the generator with the <strong>HTML</strong> tab of the post editor, not the visual one.</li>
|
||||
<li>Is a good practice to set a <strong>featured image</strong> to every page, post or work, also if it's not needed. The fetured image is very useful to better visualize the contents, especially within the grid layouts and sidebar widgets.</li>
|
||||
<li>This theme supports <strong>oEmbed</strong> to include videos. So, to add a video to your page, post or work just paste the video URL in the editor. More info <a href="http://codex.wordpress.org/Embeds" target="_blank">here</a>.</li>
|
||||
<li>The <strong>"1 Column"</strong> layout of blogs and portfolios allows you to display, for each item in the list, also media contents like videos and music players other than standard images. The other <strong>"Grid"</strong> layouts will only show the featured image of the posts. Obviously, the single page of each post will show the full featured content, whichever layout you use.</li>
|
||||
<li>If you feel that some options or settings panel described here are missing, check the top right corner of the admin. If the <strong>"Screen Options"</strong> button is there, click on it and select the panels you want to activate.</li>
|
||||
<li>Go to the <a href="options-permalink.php">Permalinks</a> page and select a permalinks structure different than the default one, eg. <strong>"Month and name"</strong>.</li>
|
||||
<li>Probably you don't want to <strong>enable comments</strong> for every page, post or work automatically... If so, go to the <a href="options-discussion.php">Discussion</a> page and uncheck the first 3 checkboxes.</li>
|
||||
<li>To enable user registration go to the <a href="options-general.php">General</a> page and check the <strong>"Membership"</strong> option. You will need to enable user registration in case you want to use an <strong>e-commerce</strong> plugin or just to keep the comments open to members only.</li>
|
||||
<li>If you use the <strong>JigoShop</strong> plugin go to its <strong>"Settings"</strong> page.<br />In the <strong>"General"</strong> tab <strong>check</strong> the <strong>"Disable Jigoshop frontend.css"</strong> and the <strong>"Disable bundled Fancybox"</strong> option.<br />In the <strong>"Images"</strong> tab check the first 3 checkboxes of the <strong>"Cropping Options"</strong> and then set the right image sizes for this theme: set <strong>"Tiny Image"</strong> to <strong>40*30</strong>, set <strong>"Thumbnail Image"</strong> to <strong>90*67</strong>, set <strong>"Catalog Image"</strong> to <strong>180*135</strong> and set <strong>"Large Image"</strong> to <strong>580*435</strong>.</li>
|
||||
<li>If you use the <strong>WooCommerce</strong> plugin go to its <strong>"Settings"</strong> page.<br />In the <strong>"General"</strong> tab <strong>uncheck</strong> the <strong>"Enable WooCommerce CSS styles"</strong>, the <strong>"Enable WooCommerce lightbox on the product page"</strong> and the <strong>"Enable AJAX add to cart buttons on product archives"</strong> options.<br />In the <strong>"Catalog"</strong> tab set the right image sizes for this theme: set <strong>"Catalog Images"</strong> to <strong>180*135</strong>, set <strong>"Single Product Image"</strong> to <strong>580*435</strong> and set <strong>"Product Thumbnails"</strong> to <strong>90*67</strong>.<br />Then, in the <strong>"Pages"</strong> tab, <strong>uncheck</strong> the <strong>"Append a logout link to menus containing My Account"</strong>.</li>
|
||||
<li>The theme automatically defines all the media sizes needed by the different templates. All the settings in the <a href="options-media.php">Media</a> page will be ignored by the theme, but they will be used by plugins and WordPress itself. So, for example, if you intend to use the built in <strong>[gallery] shortocde</strong> in your contents<strong></strong> you will have to set the sizes of the images that better fit your needs.</li>
|
||||
<li>If you add to the gallery shortcode the attribute <strong>link="file"</strong>, so the shortcode will be <strong>[gallery link="file"]</strong>, the gallery thumbnails will open the large images using the built in lightbox of the theme.</li>
|
||||
<li>So, we have explored just some of the WordPress <strong>Settings</strong> <small>(Permalinks, Discussion, General, Media)</small> and later we will check many more of them for sure. We suggest you to carefully explore all the WordPress settings, especially if you're not very familiar with this platform. In the <strong>Settings</strong> pages you will probably find most of the settings you will need during the website setup, so it's very useful to know where the important things are located.</li>
|
||||
</ol>
|
||||
|
||||
|
||||
<br />
|
||||
<small><a href="#docs_table_of_contents">^ Back to menu ^</a></small><span id="supported_plugins"></span>
|
||||
<h1>Supported Plugins</h1>
|
||||
<p>This theme supports 6 of the best WordPress plugins, that will extend the functionalities of the theme depending on your needs. During the first activation of the theme you should have noticed a yellow alert box informing you about the supported plugins. Through that alert box you can easily install all the plugins with a few clciks, just follow the instructions... or just <a href="themes.php?page=install-required-plugins" target="_self">click here</a>.</p>
|
||||
<p>The supportd plugins are the following:</p>
|
||||
<ul>
|
||||
<li><a href="http://wordpress.org/extend/plugins/background-manager/" title="Background Manager" target="_blank">Background Manager</a></li>
|
||||
<li><a href="http://wordpress.org/extend/plugins/breadcrumb-navxt/" title="Breadcrumb NavXT" target="_blank">Breadcrumb NavXT</a></li>
|
||||
<li><a href="http://wordpress.org/extend/plugins/contact-form-7/" title="Contact Form 7" target="_blank">Contact Form 7</a></li>
|
||||
<li><a href="http://wordpress.org/extend/plugins/qtranslate/" title="qTranslate" target="_blank">qTranslate</a></li>
|
||||
<li><a href="http://www.wpml.org/" title="WPML Multilingual CMS" target="_blank">WPML Multilingual CMS</a></li>
|
||||
<li><a href="http://wordpress.org/extend/plugins/jigoshop/" title="JigoShop" target="_blank">JigoShop</a></li>
|
||||
<li><a href="http://www.woothemes.com/woocommerce/" title="WooCommerce" target="_blank">WooCommerce</a></li>
|
||||
<li><a href="http://wordpress.org/extend/plugins/bbpress/" title="bbPress" target="_blank">bbPress</a></li>
|
||||
</ul>
|
||||
<p>The <a href="http://wordpress.org/extend/plugins/background-manager/" title="Background Manager" target="_blank">Background Manager</a> plugin is a fantastic tool to assign a background image or pattern to any section of your site, with outstanding transitions and effects. Check out the plugin link for more information and to learn how to properly use it.</p>
|
||||
<p>The <a href="http://wordpress.org/extend/plugins/breadcrumb-navxt/" title="Breadcrumb NavXT" target="_blank">Breadcrumb NavXT</a> is a very useful plugin to display a breadcrumbs navigation in the header area of the theme. This kind of plugins are very important to improve the user experience of your website. Check out the plugin link for more information and to learn how to properly use it.</p>
|
||||
<p>The <a href="http://wordpress.org/extend/plugins/contact-form-7/" title="Contact Form 7" target="_blank">Contact Form 7</a> plugin is an impressive tool to create any type of form. You can easily create a common and simple contact form, as well a complex and detailed form to collect any type of information from your visitors <small>(eg: a booking form for a restaurant)</small>. Check out the plugin link for more information and to learn how to properly use it.</p>
|
||||
<p>The <a href="http://www.wpml.org/" title="WPML Multilingual CMS" target="_blank">WPML Multilingual CMS</a> and the <a href="http://wordpress.org/extend/plugins/qtranslate/" title="qTranslate" target="_blank">qTranslate</a> plugins are necessay if you intend to make your website multilingial. Select the one that works better for you. WPML is commercial, more complex and absolutely complete. qTranslate is free and simpler than WPML. Check out the links for more information and to learn how to properly use these plugins.</p>
|
||||
<p><strong style="color:#ff0000;">IMPORTANT</strong> - Please understand that with this theme we only offer the best compatibility with these plugins. We are not the creators of these tools and for this reason in most of the cases we can't answer to any question about them. In order to obtain the best support we suggest to always refer to the official websites and documentation of each plugin.</p>
|
||||
<p>The <a href="http://wordpress.org/extend/plugins/jigoshop/" title="JigoShop" target="_blank">JigoShop</a> plugin is probably one of the best free plugins to create a fully functional store for your products. Sell your goods online and take your business to the next level. This plugin is very complete and for this reason it could result a little complex at the beginning. We suggest to visit the <a href="http://jigoshop.com/" title="JigoShop" target="_blank">JigoShop</a> official website and its support forum to get started.</p>
|
||||
<p>The <a href="http://www.woothemes.com/woocommerce/" title="WooCommerce" target="_blank">WooCommerce</a> plugin is probably one of the best free plugins to create a fully functional store for your products. Sell your goods online and take your business to the next level. This plugin is very complete and for this reason it could result a little complex at the beginning. We suggest to visit the <a href="http://www.woothemes.com/woocommerce/" title="WooCommerce" target="_blank">WooCommerce</a> official website and its support forum to get started.</p>
|
||||
<p>The <a href="http://wordpress.org/extend/plugins/bbpress/" title="bbPress" target="_blank">bbPress</a> plugin is probably one of the best free plugins to create a fully functional forum. We suggest to visit the <a href="http://bbpress.org/" title="bbPress" target="_blank">bbPress</a> official website and its support forum to get started.</p>
|
||||
|
||||
|
||||
<br />
|
||||
<small><a href="#docs_table_of_contents">^ Back to menu ^</a></small><span id="theme_options"></span>
|
||||
<h1>Theme Options</h1>
|
||||
<p>The theme options are located <a href="themes.php?page=ot-theme-options" target="_self">here</a>, under the Appearance menu. The options are organized in tabs:</p>
|
||||
<h3>General</h3>
|
||||
<p>In this tab you can set: logo, logo size, favicon, etc.</p>
|
||||
<h3>Sidebar</h3>
|
||||
<p>In this tab you can set the global sidebar position <small>(left, right or none)</small> and set the sidebar visibility for some specific site contents <small>(main blog, archives, portfolio, shop, forum, search, 404 error page)</small>. Page, posts, works and any other single content have their own sidebar setting <small>(available in the post's metaboxes, not in the main theme options)</small>.</p>
|
||||
<h3>Custom sidebars</h3>
|
||||
<p>In this tab you can create custom sidebars and widgets areas for any page you have. By creating a custom sidebar for a page, you will also have the option to hide the default sidebars that would be normally loaded by the page. In this way, you can have pages with unique widgets and additional contents.</p>
|
||||
<h3>Blog and blog archives</h3>
|
||||
<p>In this tab you have to set some options for the main blog and for the blog archives. Note that this theme comes with a blog <a href="#page_templates">page template</a>, but you must not make confusion between the main WordPress blog and the custom blog that you can create with the <a href="#page_templates">page template</a>. Next in the docs we'll see how to <a href="#blog_setup">set up the blog</a> more in detail and we'll make some important considerations about this topic, so be sure to read it carefully.</p>
|
||||
<h3>Portfolio archives</h3>
|
||||
<p>In this tab you have to set some options for the portfolio archives <small>(portfolio archives are all the works posts displayed by author, category, etc)</small>. Note that this theme comes with a portfolio <a href="#page_templates">page template</a>, but you must not make confusion between the portfolio archives and the custom portfolio that you can create with the <a href="#page_templates">page template</a>. Next in the docs we'll see how to <a href="#portfolio_setup">set up the portfolio</a> more in detail and we'll make some important considerations about this topic, so be sure to read it carefully.</p>
|
||||
<h3>Footer</h3>
|
||||
<p>In this tab you can set the footer layout <small>(1 to 6 columns, each one is a widgets area)</small>, the footer logo and a copyright text.</p>
|
||||
<h3>Footer social networks</h3>
|
||||
<p>In this tab you will find a very long list of social networks. Find the ones you have joined and enter the URL of your profiles. Once done small icons with the social networks logos will be displayed automatically in the footer and they will automatically link to your profile pages.</p>
|
||||
<h3>Skin</h3>
|
||||
<p>In this tab you can choose between the 2 default skins <small>(light and dark)</small> or create a custom one thanks to a very long and complete list of color options that will allow you to change any color of the theme with just a few clicks.</p>
|
||||
<h3>Typography</h3>
|
||||
<p>In this tab you can enter the CSS styles for your typography. No need to edit any CSS file, just type your styles here and save.</p>
|
||||
<p>This is how we have set up the <strong>Google Font</strong> for the theme's preview, just add to the <strong>Typography CSS</strong> field:</p>
|
||||
<pre>
|
||||
@import url(http://fonts.googleapis.com/css?family=Source+Sans+Pro);
|
||||
h1,h2,h3,h4,h5,h6,.pk_pricing_table header .pk_price{ font-family:'Source Sans Pro'; }
|
||||
</pre>
|
||||
<h3>Custom CSS</h3>
|
||||
<p>In this tab you can enter any additional CSS you want. Your custom CSS saved in this field is very safe, because if you add your styles to a theme's CSS file you risk to lose your changes when updating the theme to newer releases.</p>
|
||||
<h3>Custom JS</h3>
|
||||
<p>In this tab you can enter any additional JS script you want.</p>
|
||||
<h3>Advanced</h3>
|
||||
<p>In this tab you can simply turn on the site's performances optimization. Thanks to this option all the CSS and JS files will be minified and combined automatically, without the need of any specific plugin. Thanks to this option your web pages will load faster.</p>
|
||||
<h3>Additional options</h3>
|
||||
<p>In this tab are grouped all the new options requested by customers, that don't belong to the original theme's options.</p>
|
||||
|
||||
|
||||
<br />
|
||||
<small><a href="#docs_table_of_contents">^ Back to menu ^</a></small><span id="navigation_menus_setup"></span>
|
||||
<h1>Navigation Menus Setup</h1>
|
||||
<p>This theme supports 2 navigation menus: the main one for the header and a secondary one for the footer. Both these menus can be configured for <strong>logged in</strong> and <strong>logged out</strong> users, in case you have enabled the users registration and want to differentiate the visible contents for members and visitors.</p>
|
||||
<p>To set up the navigation menus go to the <a href="nav-menus.php" target="_self">Menus</a> page. If you've never used the WordPress menu system, we suggest to check for reference the official guide <a href="http://codex.wordpress.org/Appearance_Menus_SubPanel" target="_blank">here</a>.</p>
|
||||
|
||||
|
||||
<br />
|
||||
<small><a href="#docs_table_of_contents">^ Back to menu ^</a></small><span id="home_page_setup"></span>
|
||||
<h1>Home Page Setup</h1>
|
||||
<p>WordPress gives you 2 options for the home page <small>(front page)</small> of your site, you can:</p>
|
||||
<ol>
|
||||
<li>Display your latest <strong>blog posts <small>(your blog)</small>.</strong></li>
|
||||
<li>Display a custom <strong>page</strong>.</li>
|
||||
</ol>
|
||||
<p>If you want to go with the first option basically you don't have to do anything, because WordPress shows by default the latest posts as front page. In fact, in the <a href="options-reading.php" target="_self">Reading</a> page of the <strong>Settings</strong>, the first option <strong>"Front page displays"</strong> is set by default to the <strong>"Your latest posts"</strong> value.</p>
|
||||
<p>If you want to go with the second option, displaying a custom page, in the <a href="options-reading.php" target="_self">Reading</a> page of the <strong>Settings</strong>, the first option <strong>"Front page displays"</strong> should be set to the <strong>"A static page <small>(select below)</small>"</strong> value. Once selected, the 2 select fields below will be activated and so you will be able to assign a custom page for the home <small>(front page)</small> and one for the blog <small>(posts page)</small>. You will need to assign a page for the blog too <small>(if you want to have a blog, otherwise don't make a selection)</small>, because you won't be displaying it anymore as front page.<br /><br />The page for the blog must be a simple default empty page <small>(do not assign a page with any other <a href="#page_templates">page template</a>)</small>, with only the title <small>(used by the navigation menu)</small>. The page for your home <small>(front page)</small> can be everything. <strong>This theme has 6 special home <a href="#page_templates">page templates</a> to present your site in a very professional way.</strong></p>
|
||||
|
||||
|
||||
<br />
|
||||
<small><a href="#docs_table_of_contents">^ Back to menu ^</a></small><span id="blog_setup"></span>
|
||||
<h1>Blog Setup</h1>
|
||||
<p>As we've seen in the previous section, WordPress gives you 2 ways to set up your blog <small>(check out the <a href="#home_page_setup">Home Page Setup</a> section)</small>.</p>
|
||||
<p>If you've chosen to display it as front page or by using a blank page in a different location, we're in any case talking about the main blog <small>(WordPress is basically a blogging platform, so the blog exists before the egg and the chicken)</small>. The options to manage its layout are within the <strong>"Blog and blog archives"</strong> tab of the <a href="themes.php?page=ot-theme-options" target="_self">Theme Options</a> page.</p>
|
||||
<p><strong>With "main blog and blog archives" we intend the default WordPress blog pages <small>(blog archives are all the blog posts displayed by author, date, category, tag, etc)</small>, we're not referring to any <a href="#page_templates">page template</a> that is meant to generate custom or alternative blogs</strong>. This theme has a custom blog <a href="#page_templates">page template</a>, but it doesn't use the global blog options. To avoid any confusion, we'll check the blog <a href="#page_templates">page template</a> later in the docs to see how it works and how to set it up.</p>
|
||||
<p><strong style="color:#ff0000;">IMPORTANT 1</strong> - Note that, normally, the number of blog posts displayed per page should be set in the <a href="options-reading.php" target="_self">Reading</a> page of the <strong>Settings</strong> through the <strong>"Blog pages show at most"</strong> option. This theme overrides this setting, so you don't have to set it. Basically, the number of blog posts displayed per page is returned by the <strong>"columns*rows"</strong> multiplication set for the blog layout within the <strong>"Blog and blog archives"</strong> tab of the <a href="themes.php?page=ot-theme-options" target="_self">Theme Options</a> page.</p>
|
||||
<p><strong style="color:#ff0000;">IMPORTANT 2</strong> - Note that the <strong>sidebar visibility</strong> option for the <strong>"main blog and blog archives"</strong> is located within the <strong>"Sidebar"</strong> tab of the <a href="themes.php?page=ot-theme-options" target="_self">Theme Options</a> page.</p>
|
||||
|
||||
|
||||
<br />
|
||||
<small><a href="#docs_table_of_contents">^ Back to menu ^</a></small><span id="portfolio_setup"></span>
|
||||
<h1>Portfolio Setup</h1>
|
||||
<p>To set up your portfolio you need to:</p>
|
||||
<ol>
|
||||
<li><a href="post-new.php?post_type=page" target="_self">Create a new page</a>, give it a title, assign the <strong>"Portfolio Template"</strong> and save. Once saved the page options will appear below the editor.</li>
|
||||
<li>Through the page options panel you can add specific categories to the portfolio <small>(don't select any to include them all)</small> and most importantly set the layout.</li>
|
||||
<li>As last operation, you have to assign the layout for the portfolio archives <small>(portfolio archives are all the works posts displayed by author, category, etc)</small> in the <strong>"Portfolio archives"</strong> tab of the <a href="themes.php?page=ot-theme-options" target="_self">Theme Options</a> page.</li>
|
||||
</ol>
|
||||
<p>You can add new works <a href="edit.php?post_type=portfolio" target="_self">here</a>. You can drag and drop your works to sort them as you want <a href="edit.php?post_type=portfolio&page=pk_portfolio.php" target="_self">here</a></p>
|
||||
|
||||
|
||||
<br />
|
||||
<small><a href="#docs_table_of_contents">^ Back to menu ^</a></small><span id="creating_pages"></span>
|
||||
<h1>Creating Pages</h1>
|
||||
<p>To publish a page you need to <a href="post-new.php?post_type=page" target="_self">create a new page</a>, give it a title, assign a <a href="#page_templates">page template</a> or a <a href="#formats">format</a> and save. Once saved, an options panel will appear below the editor <small>(if available)</small>. Check the <a href="#page_templates">Page Templates</a> section for more info.</p>
|
||||
|
||||
|
||||
<br />
|
||||
<small><a href="#docs_table_of_contents">^ Back to menu ^</a></small><span id="creating_blog_posts"></span>
|
||||
<h1>Creating Blog Posts</h1>
|
||||
<p>To publish a blog post you need to <a href="post-new.php" target="_self">create a new post</a>, give it a title, assign a <a href="#formats">format</a> and save. Once saved, an options will appear below the editor <small>(if available)</small>.<br /><br />The supported <a href="#formats">formats</a> are the following:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/post_formats.png" /><br />Check the <a href="#formats">Formats</a> section for detailed instructions about how to implement each format.</p>
|
||||
|
||||
|
||||
<br />
|
||||
<small><a href="#docs_table_of_contents">^ Back to menu ^</a></small><span id="creating_works"></span>
|
||||
<h1>Creating Works</h1>
|
||||
<p>To publish a work you need to <a href="post-new.php?post_type=portfolio" target="_self">create a new work</a>, give it a title, assign a <a href="#formats">format</a> and save. Once saved, an options panel will appear below the editor <small>(if available)</small>.<br /><br />The supported <a href="#formats">formats</a> are the following:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/page_work_formats.png" /><br />Check the <a href="#formats">Formats</a> section for detailed instructions about how to implement each format.</p>
|
||||
|
||||
|
||||
<br />
|
||||
<small><a href="#docs_table_of_contents">^ Back to menu ^</a></small><span id="page_templates"></span>
|
||||
<h1>Page Templates</h1>
|
||||
<p><strong style="color:#ff0000;">IMPORTANT</strong> - To activate the <strong>options panel</strong> of each page template: <strong>select the page template and save</strong>, only after saving the right options panel will be displayed.</p>
|
||||
<p>This theme comes with 10 custom page templates. When you <a href="post-new.php?post_type=page" target="_self">create a new page</a> you can select the one you want from the <strong>"Template"</strong> option within the <strong>"Page Attributes"</strong> box below the save button:</p>
|
||||
<img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/page_templates.png" />
|
||||
<ol>
|
||||
<li>The <strong>"Default Template"</strong> obviously is the basic standard page template of WordPress and it supports the sidebar. It's the <strong>right one for the main blog</strong> <small>(check the <a href="#blog_setup">Blog Setup</a> section)</small> or for any other non specific content. You can assign to it a <strong>"Format"</strong> and, depending on the selected one, the page will behave differently.<br /><br />The supported <a href="#formats">formats</a> by the <strong>"Default Template"</strong> are the following:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/page_work_formats.png" /><br />Check the <a href="#formats">Formats</a> section for detailed instructions about how to implement each format.</li>
|
||||
|
||||
<li>The <strong>"Blog Template"</strong> is a page template that recreates the WordPress blog. This page template should be used only in case you want to have a layout for the main blog and a different one for the blog archives <small>(blog archives are all the blog posts displayed by author, date, category, tag, etc)</small>. To do this you need to:<br /><br />
|
||||
<ol>
|
||||
<li>Select a static page to use as home page and leave empty the selection for the default blog page as explained in the <a href="#home_page_setup">Home Page Setup</a> section.</li>
|
||||
<li><a href="post-new.php?post_type=page" target="_self">Create a new page</a>, give it a title, assign the <strong>"Blog Template"</strong> and save. Once saved the page options will appear as explained at the beginning of this section.</li>
|
||||
<li>Through the page options panel you can add specific categories to the blog <small>(don't select any to include them all)</small> and most importantly set the layout.</li>
|
||||
<li>As last operation, you have to assign the layout for the blog archives in the <strong>"Blog and blog archives"</strong> tab of the <a href="themes.php?page=ot-theme-options" target="_self">Theme Options</a> page.</li>
|
||||
</ol>
|
||||
This page template activates this options panel below the editor:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/blog_page_options.png" /></li>
|
||||
|
||||
<li>The <strong>"FAQ Template"</strong> is a full width page template that loads within an <strong>"Accordion"</strong> or <strong>"Toggle"</strong> component the <a href="edit.php?post_type=faq" target="_blank">FAQ</a> posts for your frequently asked questions section.<br /><br />This page template activates this options panel below the editor:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/faq_page_options.png" /></li>
|
||||
|
||||
<li>The <strong>"Full Width Template"</strong> is exactly like the <strong>"Default Template"</strong>, with the only difference that it doesn't have the sidebar. You can assign to it a <strong>"Format"</strong> and, depending on the selected one, the page will behave differently.<br /><br />The supported <a href="#formats">formats</a> by the <strong>"Full Width Template"</strong> are the following:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/page_work_formats.png" /><br />Check the <a href="#formats">Formats</a> section for detailed instructions about how to implement each format.</li>
|
||||
|
||||
<li>The <strong>"Home Page Agency Template"</strong> is a full width home page template that features an <strong>image slider</strong> with a <strong>widgets area</strong> on its right, <strong>3 additional widgets areas</strong> and, after the page contents area, it loads some of your <strong>recent works</strong>. You can preview this page <a href="http://sold.parkerandkent.com/sold/homepage-agency/" target="_blank">here</a>. To create this kind of page you have to <a href="post-new.php?post_type=page" target="_self">create a new page</a>, give it a title, assign the <strong>"Home Page Agency Template"</strong> and save. Once saved the page options will appear below the editor as explained at the beginning of this section.<br /><br />All the <strong>widgets areas</strong> must be set in the <a href="widgets.php" target="_blank">Widgets</a> page of the admin. For more info about sidebars and widgets read <a href="#sidebars_and_widgets_areas">here</a>.<br /><br />The <strong>recent works</strong> must be set within the options panel of the page.<br /><br />Setting up the slider is very easy. Just upload your images <small>(width: 610px, height: any)</small> by clicking on the <strong>"Upload/Insert"</strong> button on the top left corner of the editor, so they will result as page attachments <small>(WordPress post's gallery feature)</small>:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/add_media.png" /><br /><br />When you access the media manager <small>(by clicking on the <strong>"Upload/Insert"</strong> button)</small> you will find a <strong>"Gallery"</strong> tab that will list all the uploaded images.<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/drop_media.png" /><br /><br />In this tab you can reorder the images and set the titles and descriptions, that will be displayed by the slider. For more detailed information about all the functionalities of the home page slider <a href="#the_home_page_templates_slider">read this section</a>.<br /><br />This page template activates this options panel below the editor:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/home_agency_options.png" /></li>
|
||||
|
||||
<li>The <strong>"Home Page Business Template"</strong> is a full width home page template that features an <strong>image slider</strong>, an <strong>RSS feed reader</strong> below the slider, a <strong>tabs component</strong>, <strong>3 widgets areas</strong> and the featured image <small>(<a href="http://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail" target="_blank">how to set a featured image</a>)</small> just before the footer. You can preview this page <a href="http://sold.parkerandkent.com/sold/homepage-business/" target="_blank">here</a>. To create this kind of page you have to <a href="post-new.php?post_type=page" target="_self">create a new page</a>, give it a title, assign the <strong>"Home Page Business Template"</strong> and save. Once saved the page options will appear below the editor as explained at the beginning of this section.<br /><br />The <strong>RSS feed reader</strong> must be set within the options panel of the page.<br /><br />The <strong>tabs component</strong> is populated by the contents of the sub pages. Once you have created the home page with this template, create some new child pages. <strong>Every child page will be added to the tabs.</strong> To create a child page just create a new page with the <strong>"Default Template"</strong>, enter the title and the contents and then, in the <strong>"Page Attributes"</strong> panel, select the main home page from the <strong>"Parent"</strong> select option:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/page_templates.png" /><br /><br />All the <strong>widgets areas</strong> must be set in the <a href="widgets.php" target="_blank">Widgets</a> page of the admin. For more info about sidebars and widgets read <a href="#sidebars_and_widgets_areas">here</a>.<br /><br />The <strong>featured image</strong> <small>(<a href="http://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail" target="_blank">how to set a featured image</a>)</small> of the home page, as you can see in the page preview linked before, is loaded just before the footer. We have used it to showcase some logos. You can do the same with the logos of your best clients.<br /><br />Setting up the slider is very easy. Just upload your images <small>(width: 980px, height: any)</small> by clicking on the <strong>"Upload/Insert"</strong> button on the top left corner of the editor, so they will result as page attachments <small>(WordPress post's gallery feature)</small>:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/add_media.png" /><br /><br />When you access the media manager <small>(by clicking on the <strong>"Upload/Insert"</strong> button)</small> you will find a <strong>"Gallery"</strong> tab that will list all the uploaded images.<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/drop_media.png" /><br /><br />In this tab you can reorder the images and set the titles and descriptions, that will be displayed by the slider. For more detailed information about all the functionalities of the home page slider <a href="#the_home_page_templates_slider">read this section</a>.<br /><br />This page template activates this options panel below the editor:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/home_business_options.png" /></li>
|
||||
|
||||
<li>The <strong>"Home Page Freelance Template"</strong> is a full width home page template that features an <strong>image slider</strong> with a <strong>call to action</strong> text, <strong>3 widgets areas</strong> and, after the page contents area, it loads some of your <strong>recent works</strong>. You can preview this page <a href="http://sold.parkerandkent.com/sold/homepage-freelance/" target="_blank">here</a>. To create this kind of page you have to <a href="post-new.php?post_type=page" target="_self">create a new page</a>, give it a title, assign the <strong>"Home Page Freelance Template"</strong> and save. Once saved the page options will appear below the editor as explained at the beginning of this section.<br /><br />The <strong>call to action</strong> text must be set within the options panel of the page.<br /><br />All the <strong>widgets areas</strong> must be set in the <a href="widgets.php" target="_blank">Widgets</a> page of the admin. For more info about sidebars and widgets read <a href="#sidebars_and_widgets_areas">here</a>.<br /><br />The <strong>recent works</strong> must be set within the options panel of the page.<br /><br />Setting up the slider is very easy. Just upload your images <small>(width: 980px, height: any)</small> by clicking on the <strong>"Upload/Insert"</strong> button on the top left corner of the editor, so they will result as page attachments <small>(WordPress post's gallery feature)</small>:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/add_media.png" /><br /><br />When you access the media manager <small>(by clicking on the <strong>"Upload/Insert"</strong> button)</small> you will find a <strong>"Gallery"</strong> tab that will list all the uploaded images.<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/drop_media.png" /><br /><br />In this tab you can reorder the images and set the titles and descriptions, that will be displayed by the slider. For more detailed information about all the functionalities of the home page slider <a href="#the_home_page_templates_slider">read this section</a>.<br /><br />This page template activates this options panel below the editor:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/home_freelance_options.png" /></li>
|
||||
|
||||
<li>The <strong>"Home Page JigoShop Template"</strong> is an home page template with sidebar that features an <strong>image slider</strong> with a <strong>call to action</strong> text, <strong>2 additional widgets areas</strong> and, after the page contents area, it loads some of your <strong>featured and recent products</strong>. You can preview this page <a href="http://sold.parkerandkent.com/sold/homepage-jigoshop/" target="_blank">here</a>. To create this kind of page you have to <a href="post-new.php?post_type=page" target="_self">create a new page</a>, give it a title, assign the <strong>"Home Page JigoShop Template"</strong> and save. Once saved the page options will appear below the editor as explained at the beginning of this section.<br /><br />The <strong>call to action</strong> text must be set within the options panel of the page.<br /><br />All the <strong>widgets areas</strong> and the main <strong>sidebar</strong> must be set in the <a href="widgets.php" target="_blank">Widgets</a> page of the admin. For more info about sidebars and widgets read <a href="#sidebars_and_widgets_areas">here</a>.<br /><br />The <strong>featured and recent products</strong> must be set within the options panel of the page.<br /><br />Setting up the slider is very easy. Just upload your images <small>(width: 980px, height: any)</small> by clicking on the <strong>"Upload/Insert"</strong> button on the top left corner of the editor, so they will result as page attachments <small>(WordPress post's gallery feature)</small>:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/add_media.png" /><br /><br />When you access the media manager <small>(by clicking on the <strong>"Upload/Insert"</strong> button)</small> you will find a <strong>"Gallery"</strong> tab that will list all the uploaded images.<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/drop_media.png" /><br /><br />In this tab you can reorder the images and set the titles and descriptions, that will be displayed by the slider. For more detailed information about all the functionalities of the home page slider <a href="#the_home_page_templates_slider">read this section</a>.<br /><br />This page template activates this options panel below the editor:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/home_jigoshop_woocommerce_options.png" /></li>
|
||||
|
||||
<li>The <strong>"Home Page Standard Template"</strong> is an home page template with sidebar that features an <strong>image slider</strong>, an <strong>active featured image</strong>, a <strong>call to action</strong> text, <strong>2 additional widgets areas</strong> and, after the page contents area, it loads some of your <strong>recent works and blog posts</strong>. You can preview this page <a href="http://sold.parkerandkent.com/sold/homepage-standard/" target="_blank">here</a>. To create this kind of page you have to <a href="post-new.php?post_type=page" target="_self">create a new page</a>, give it a title, assign the <strong>"Home Page Standard Template"</strong> and save. Once saved the page options will appear below the editor as explained at the beginning of this section.<br /><br />The <strong>active featured image</strong> <small>(<a href="http://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail" target="_blank">how to set a featured image</a>)</small> supports the <strong>"snap points"</strong> like the slider. To know how to set up the <strong>"snap points"</strong> just check out <a href="#the_home_page_templates_slider">this section</a><br /><br />The <strong>call to action</strong> text must be set within the options panel of the page.<br /><br />All the <strong>widgets areas</strong> and the main <strong>sidebar</strong> must be set in the <a href="widgets.php" target="_blank">Widgets</a> page of the admin. For more info about sidebars and widgets read <a href="#sidebars_and_widgets_areas">here</a>.<br /><br />The <strong>recent works and blog posts</strong> must be set within the options panel of the page.<br /><br />Setting up the slider is very easy. Just upload your images <small>(width: 980px, height: any)</small> by clicking on the <strong>"Upload/Insert"</strong> button on the top left corner of the editor, so they will result as page attachments <small>(WordPress post's gallery feature)</small>:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/add_media.png" /><br /><br />When you access the media manager <small>(by clicking on the <strong>"Upload/Insert"</strong> button)</small> you will find a <strong>"Gallery"</strong> tab that will list all the uploaded images.<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/drop_media.png" /><br /><br />In this tab you can reorder the images and set the titles and descriptions, that will be displayed by the slider. For more detailed information about all the functionalities of the home page slider <a href="#the_home_page_templates_slider">read this section</a>.<br /><br />This page template activates this options panel below the editor:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/home_standard_options.png" /></li>
|
||||
|
||||
<li>The <strong>"Home Page WooCommerce Template"</strong> is an home page template with sidebar that features an <strong>image slider</strong> with a <strong>call to action</strong> text, <strong>2 additional widgets areas</strong> and, after the page contents area, it loads some of your <strong>featured and recent products</strong>. You can preview this page <a href="http://sold.parkerandkent.com/sold/homepage-jigoshop/" target="_blank">here</a>. To create this kind of page you have to <a href="post-new.php?post_type=page" target="_self">create a new page</a>, give it a title, assign the <strong>"Home Page WooCommerce Template"</strong> and save. Once saved the page options will appear below the editor as explained at the beginning of this section.<br /><br />The <strong>call to action</strong> text must be set within the options panel of the page.<br /><br />All the <strong>widgets areas</strong> and the main <strong>sidebar</strong> must be set in the <a href="widgets.php" target="_blank">Widgets</a> page of the admin. For more info about sidebars and widgets read <a href="#sidebars_and_widgets_areas">here</a>.<br /><br />The <strong>featured and recent products</strong> must be set within the options panel of the page.<br /><br />Setting up the slider is very easy. Just upload your images <small>(width: 980px, height: any)</small> by clicking on the <strong>"Upload/Insert"</strong> button on the top left corner of the editor, so they will result as page attachments <small>(WordPress post's gallery feature)</small>:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/add_media.png" /><br /><br />When you access the media manager <small>(by clicking on the <strong>"Upload/Insert"</strong> button)</small> you will find a <strong>"Gallery"</strong> tab that will list all the uploaded images.<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/drop_media.png" /><br /><br />In this tab you can reorder the images and set the titles and descriptions, that will be displayed by the slider. For more detailed information about all the functionalities of the home page slider <a href="#the_home_page_templates_slider">read this section</a>.<br /><br />This page template activates this options panel below the editor:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/home_jigoshop_woocommerce_options.png" /></li>
|
||||
|
||||
<li>The <strong>"Portfolio Template"</strong> is the page template to load your <a href="edit.php?post_type=portfolio" target="_self">works</a>. To do this you need to:<br /><br />
|
||||
<ol>
|
||||
<li><a href="post-new.php?post_type=page" target="_self">Create a new page</a>, give it a title, assign the <strong>"Portfolio Template"</strong> and save. Once saved the page options will appear below the editor as explained at the beginning of this section.</li>
|
||||
<li>Through the page options panel you can add specific categories to the portfolio <small>(don't select any to include them all)</small> and most importantly set the layout.</li>
|
||||
<li>As last operation, you have to assign the layout for the portfolio archives <small>(portfolio archives are all the works posts displayed by author, category, etc)</small> in the <strong>"Portfolio archives"</strong> tab of the <a href="themes.php?page=ot-theme-options" target="_self">Theme Options</a> page.</li>
|
||||
</ol>
|
||||
This page template activates this options panel below the editor:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/portfolio_page_options.png" /></li>
|
||||
</ol>
|
||||
|
||||
|
||||
<br />
|
||||
<small><a href="#docs_table_of_contents">^ Back to menu ^</a></small><span id="formats"></span>
|
||||
<h1>Formats</h1>
|
||||
<p><strong style="color:#ff0000;">IMPORTANT 1</strong> - To activate the options of each format: <strong>select the format and save</strong>, only after saving the right options panel will be displayed.</p>
|
||||
<p><strong style="color:#ff0000;">IMPORTANT 2</strong> - <span style="text-decoration:underline;">Because the blog posts formats are a default feature of WordPress and cannot be edited, while the formats for portfolio posts (works) and pages are something we've created from scratch, we need to make a clarification about format names and capabilities:</span></p>
|
||||
<ol>
|
||||
<li>The <strong>"Standard"</strong> format of blog posts <strong>has the capabilities of both</strong> the <strong>"Standard"</strong> and <strong>"Image"</strong> formats explained next in this section.</li>
|
||||
<li>The <strong>"Image"</strong> format of blog posts <strong>is the equivalent of</strong> the <strong>"Lightbox Gallery"</strong> format explained next in this section.</li>
|
||||
<li>The <strong>"Gallery"</strong> format of blog posts <strong>is the equivalent of</strong> the <strong>"Slider"</strong> format explained next in this section.</li>
|
||||
</ol>
|
||||
<p>After this clarification, let's see how each format works:</p>
|
||||
<ol>
|
||||
<li>The <strong>"Standard"</strong> format as you can imagine doesn't have any talent, it's plain. We suggest to set a <strong>"Featured Image"</strong> <small>(<a href="http://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail" target="_blank">how to set a featured image</a>)</small>, because it will be used as thumbnail where needed <small>(widgets, lists, grid layouts, etc.)</small>.<br /><br />This format activates this options panel below the editor (only for blog posts and portfolio posts):<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/sidebar_options.png" /></li>
|
||||
<li>The <strong>"Aside"</strong> format is meant to display a content without a title, similar to a Facebook note update. We suggest anyway to set a <strong>"Featured Image"</strong> <small>(<a href="http://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail" target="_blank">how to set a featured image</a>)</small>, because it will be used as thumbnail where needed <small>(widgets, lists, grid layouts, etc.)</small>.<br /><br />This format activates this options panel below the editor:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/sidebar_options.png" /></li>
|
||||
<li>The <strong>"Status"</strong> format is meant to display a short status update, similar to a Twitter status update. We suggest anyway to set a <strong>"Featured Image"</strong> <small>(<a href="http://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail" target="_blank">how to set a featured image</a>)</small>, because it will be used as thumbnail where needed <small>(widgets, lists, grid layouts, etc.)</small>.<br /><br />This format activates this options panel below the editor:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/sidebar_options.png" /></li>
|
||||
<li>The <strong>"Chat"</strong> format is meant to display a chat transcript. We suggest anyway to set a <strong>"Featured Image"</strong> <small>(<a href="http://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail" target="_blank">how to set a featured image</a>)</small>, because it will be used as thumbnail where needed <small>(widgets, lists, grid layouts, etc.)</small>.<br /><br />This format activates this options panel below the editor:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/sidebar_options.png" /></li>
|
||||
<li>The <strong>"Link"</strong> format is meant to display an external link instead of the title and a little description. We suggest anyway to set a <strong>"Featured Image"</strong> <small>(<a href="http://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail" target="_blank">how to set a featured image</a>)</small>, because it will be used as thumbnail where needed <small>(widgets, lists, grid layouts, etc.)</small>.<br /><br />This format activates this options panel below the editor:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/post_link_options.png" /></li>
|
||||
<li>The <strong>"Quote"</strong> format is meant to display a quotation. We suggest anyway to set a <strong>"Featured Image"</strong> <small>(<a href="http://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail" target="_blank">how to set a featured image</a>)</small>, because it will be used as thumbnail where needed <small>(widgets, lists, grid layouts, etc.)</small>.<br /><br />This format activates this options panel below the editor:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/post_quote_options.png" /></li>
|
||||
<li>The <strong>"Image"</strong> format will automatically display the <strong>"Featured Image"</strong> <small>(<a href="http://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail" target="_blank">how to set a featured image</a>)</small> before any other content. <br /><br />The <strong>"Featured Image"</strong> of this page format can have a link, internal or external with _self or _blank window target. To set up the link and the target you need to access the image properties panel <small>(through the main <a href="upload.php" target="_self">Media</a> library or directly through the attachment)</small>, enter the data in the dedicated fields and save the changes:<br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/image_options_links.png" /><br /><br />This format activates this options panel below the editor (only for blog posts and portfolio posts):<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/sidebar_options.png" /></li>
|
||||
<li>The <strong>"Video"</strong> format will display a video <small>(YouTube, Vimeo, self hosted, etc.)</small> before any other content of the page. To set up a video you first need to set up a <strong>"Featured Image"</strong> <small>(<a href="http://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail" target="_blank">how to set a featured image</a>)</small> and then you need to access the image properties panel <small>(through the main <a href="upload.php" target="_self">Media</a> library or directly through the attachment)</small>, enter the data in the dedicated fields and save the changes:
|
||||
<br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/image_options_video.png" /><br />
|
||||
The <strong>"Featured Image"</strong> is required to hold the video information and it will be used as cover where needed <small>(widgets, lists, grid layouts, etc.)</small>. If you don't have a specific image for the video you can just upload a screenshot or a standard symbolic cover that you will use for every video. <strong>Depending on the video type you're going to use, you will need to fill 1 of the 2 dedicated fields</strong>.<br /><br />The <strong>"Video URL"</strong> field should be filled with the video URL of services like <strong>YouTube, Vimeo, DailyMotion</strong> or any other supported by the WordPress embedding system <small>(more info <a href="http://codex.wordpress.org/Embeds" target="_blank">here</a>)</small>.<br /><br />The <strong>"Video File/s"</strong> field should be filled with a comma separated list of different encodings of a self hosted video file, that will be played with the built in html5 media player. It's a good practice to enter more than one version of the file <small>(m4v and ogv at least)</small> for a better cross browser compatibility. This is an example of comma separated string to enter: <strong>http://www.your-site.com/your_video.m4v,http://www.your-site.com/your_video.ogv</strong><br /><br /><strong style="color:#ff0000;">IMPORTANT</strong> - Note that if you just want to include a video from <strong>YouTube, Vimeo, DailyMotion</strong> or from any other supported provider by the WordPress embedding system <small>(more info <a href="http://codex.wordpress.org/Embeds" target="_blank">here</a>)</small>, you can also avoid to use the <strong>"Video"</strong> format and just paste the Video URL within your page content, in any position. Of course, for self hosted videos, you need to follow the previous instructions.<br /><br />This format activates this options panel below the editor (only for blog posts and portfolio posts):<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/sidebar_options.png" /></li>
|
||||
<li>The <strong>"Audio"</strong> format will display an audio player before any other content of the page. To set up an audio player you first need to set up a <strong>"Featured Image"</strong> <small>(<a href="http://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail" target="_blank">how to set a featured image</a>)</small> and then you need to access the image properties panel <small>(through the main <a href="upload.php" target="_self">Media</a> library or directly through the attachment)</small>, enter the data in the dedicated fields and save the changes:<br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/image_options_audio.png" /><br />The <strong>"Featured Image"</strong> is required to hold the audio information and it will be used as cover where needed <small>(widgets, lists, grid layouts, etc.)</small>. If you don't have a specific image for the audio file you're loading you can just upload a standard symbolic cover that you will use for every audio file. <strong>To set up the audio player you just need to fill 1 field</strong>.<br /><br />The <strong>"Audio File/s"</strong> field should be filled with a comma separated list of different encodings of a self hosted audio file, that will be played with the built in html5 media player. It's a good practice to enter more than one version of the file <small>(mp3 and m4a at least)</small> for a better cross browser compatibility. This is an example of comma separated string to enter: <strong>http://www.your-site.com/your_audio.mp3,http://www.your-site.com/your_audio.m4a</strong>.<br /><br />This format activates this options panel below the editor (only for blog posts and portfolio posts):<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/sidebar_options.png" /></li>
|
||||
<li>The <strong>"Slider"</strong> format will automatically display an image slider before any other content. We suggest to set up a <strong>"Featured Image"</strong> <small>(<a href="http://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail" target="_blank">how to set a featured image</a>)</small>, because it will be used as thumbnail where needed <small>(widgets, lists, grid layouts, etc.)</small>.<br /><br /><strong>You can add an unlimited number of images of any size to the slider</strong>. Just upload your images by clicking on the <strong>"Upload/Insert"</strong> button on the top left corner of the editor, so they will result as page attachments <small>(WordPress post's gallery feature)</small>:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/add_media.png" /><br /><br />When you access the media manager <small>(by clicking on the <strong>"Upload/Insert"</strong> button)</small> you will find a <strong>"Gallery"</strong> tab that will list all the uploaded images.<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/drop_media.png" /><br /><br />In this tab you can reorder the images and access their properties panel. Additionally, every image of the slider will use the lightbox to open the large/original size of the same image.<br /><br />You can also load a video instead of the large/original version, simply filling the <strong>"Video URL"</strong> field in the properties panel of the image <small>(as seen before for the "Video" format)</small>. Note that the built in lighbox supports specific video providers <small>(YouTube, Vimeo, DailyMotion)</small> and formats <small>(swf, mov)</small>. For more info check the official <a href="http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/" target="_blank">PrettyPhoto</a> website.<br /><br />This format activates this options panel below the editor:</small><br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/post_work_slider_options.png" /></li>
|
||||
<li>The <strong>"Gallery"</strong> format of blog posts is the equivalent of the <strong>"Slider"</strong> format of the portfolio posts (works) and pages, please refer to it.</li>
|
||||
<li>The <strong>"Lightbox Gallery"</strong> format will automatically add a cover image linked to a lightbox gallery before any other content. You first need to set up a <strong>"Featured Image"</strong> <small>(<a href="http://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail" target="_blank">how to set a featured image</a>)</small>, because it will be used as thumbnail where needed <small>(widgets, lists, grid layouts, etc.)</small> and it will be used as cover image to open the lightbox gallery by simply clicking on it.<br /><br /><strong>You can add an unlimited number of images of any size to the lightbox gallery</strong>. Just upload your images by clicking on the <strong>"Upload/Insert"</strong> button on the top left corner of the editor, so they will result as page attachments <small>(WordPress post's gallery feature)</small>:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/add_media.png" /><br /><br />When you access the media manager <small>(by clicking on the <strong>"Upload/Insert"</strong> button)</small> you will find a <strong>"Gallery"</strong> tab that will list all the uploaded images.<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/drop_media.png" /><br /><br />In this tab you can reorder the images and access their properties panel.<br /><br />You can also load videos instead of the images <small>(symbolic covers, they won't be displayed, they just hold the videos information)</small>, simply filling the <strong>"Video URL"</strong> field in the properties panel of the image <small>(as seen before for the "Video" format)</small>. Note that the built in lighbox supports specific video providers <small>(YouTube, Vimeo, DailyMotion)</small> and formats <small>(swf, mov)</small>. For more info check the official <a href="http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/" target="_blank">PrettyPhoto</a> website.<br /><br />This format activates this options panel below the editor:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/sidebar_options.png" /></li>
|
||||
</ol>
|
||||
|
||||
|
||||
<br />
|
||||
<small><a href="#docs_table_of_contents">^ Back to menu ^</a></small><span id="the_home_page_templates_slider"></span>
|
||||
<h1>The Home Page Templates Slider</h1>
|
||||
<p>As we've seen before for the home page templates in the <a href="#page_templates">Page Templates</a> section, setting up the slider is very easy. Just upload your images by clicking on the <strong>"Upload/Insert"</strong> button on the top left corner of the editor, so they will result as page attachments <small>(WordPress post's gallery feature)</small>:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/add_media.png" /><br /><br />When you access the media manager <small>(by clicking on the <strong>"Upload/Insert"</strong> button)</small> you will find a <strong>"Gallery"</strong> tab that will list all the uploaded images.<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/drop_media.png" /><br /><br />In this tab <strong>you can reorder the images and set the titles and descriptions</strong>, that will be displayed by the slider.</p>
|
||||
<p>In this section we want to describe some cool features of the home page slider, we'll see how to: manage the positioning/aspect of <strong>titles and descriptions</strong>, create the <strong>"snap points"</strong> and how to associate a <strong>link</strong> or a <strong>video</strong> to any image of the slider.</p>
|
||||
<p>As just seen, all the images uploaded through the media manager of your home page will be listed under the <strong>"Gallery"</strong> tab. If you access the properties panel of each image you will see this screen:</p>
|
||||
<p><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/image_options.png" /></p>
|
||||
<p>The <strong>positioning/aspect</strong> of the titles and descriptions of each slide is indipendent and thanks to the <strong>"Title Properties"</strong> and <strong>"Description Properties"</strong> fields you can edit them easily. As you can see below each field there is an example of string to enter. For the title we have the sample string: <strong>{'x':'100', 'y':'100', 'width':'350', 'color':'#ffffff', 'bg_color':'#000000'}</strong>.</p>
|
||||
<p>Basically, this string contains some information that the slider uses to set the position of the title, the width of the text, the text color and the background color. Edit this string as you need, be just sure to <strong>respect the quotes around the properties names and their values</strong>, otherwise you could have some problems. The same properties are available for the description, so just follow the instructions for the title.</p>
|
||||
<p>The <strong>"snap points"</strong> are active buttons that you can place on your slides, to feature some details or to add additional informations. You can add as many <strong>"snap points"</strong> as you want, position them anywhere on the images and open any inline HTML content when the user makes a roll over with the mouse. Basically the <strong>"snap points"</strong> are contained by an unordered list <strong><ul></ul></strong> and each of them is a <strong><li></li></strong> element, containing the HTML markup to visualize on roll over. The following is an example of 2 <strong>"snap points"</strong> we've added to a slide of the theme's preview. Check it carefully, trying to understand the role of each line:
|
||||
<pre>
|
||||
<ul>
|
||||
<li class="pk_snap_point" data-properties="properties={'x':'310','y':'90','tooltip_width':'230','color':'blue'}">
|
||||
<img src="http://sold.parkerandkent.com/sold/wp-content/uploads/2012/09/jigoshop_slides_01_d_01.jpg" alt="Detail 01" />
|
||||
<p>Easy controller...</p>
|
||||
</li>
|
||||
<li class="pk_snap_point" data-properties="properties={'x':'430','y':'380','tooltip_width':'245','color':'blue'}">
|
||||
<img src="http://sold.parkerandkent.com/sold/wp-content/uploads/2012/09/jigoshop_slides_01_d_02.jpg" alt="Detail 02" />
|
||||
<h4>18x Wide Optic</h4>
|
||||
<p>Quat vel illum eu feugiat facil...</p>
|
||||
</li>
|
||||
</ul>
|
||||
</pre>
|
||||
<p>Obviously, the code above goes into the <strong>"Snap Points"</strong> field within the properties panel of each slide image.</p>
|
||||
<p>To associate a <strong>link</strong> to a slide, internal or external, you simply have to fill the <strong>"Image Custom Link"</strong> and <strong>"Image Custom Link Target"</strong> fields, always in the properties panel of the slides.</p>
|
||||
<p>To associate a <strong>video</strong> to a slide you simply have to fill the <strong>"Video URL"</strong> field. Note that the built in lighbox supports specific video providers <small>(YouTube, Vimeo, DailyMotion)</small> and formats <small>(swf, mov)</small>. For more info check the official <a href="http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/" target="_blank">PrettyPhoto</a> website.</p>
|
||||
|
||||
|
||||
<br />
|
||||
<small><a href="#docs_table_of_contents">^ Back to menu ^</a></small><span id="sidebars_and_widgets_areas"></span>
|
||||
<h1>Sidebars and Widgets Areas</h1>
|
||||
<p>This theme comes with <strong>31 default sidebars and widgets areas</strong> and almost 60 custom widgets <small>(including the customized widgets of the supported plugins)</small>.</p>
|
||||
<p>In the <a href="widgets.php" target="_blank">Widgets</a> page you will find all the available widgets and, on the right, all the registered sidebars. To add a widget to a sidebar, expand the selected sidebar panel and then drag and drop the widget over it. Once dropped, fill in the required fields and save.</p>
|
||||
<p>This is the list of the sidebars and widgets areas available for this theme:
|
||||
<ol>
|
||||
<li><strong>Sidebar - All</strong> - This is a global sidebar that will be loaded in every page. So, if you want to have some widgets always visible, you need to add them to this sidebar.</li>
|
||||
<li><strong>Sidebar - Front Page </strong> - This sidebar will be displayed only within the home page, if you have set for the home a static page using a template that support a sidebar. More info <a href="#home_page_setup">here</a>.</li>
|
||||
<li><strong>Sidebar - JigoShop </strong> - This sidebar will be loaded in every page belonging to the <strong>JigoShop</strong> plugin <small>(shop, cart, products, product categories, etc.)</small>. If you have set the <strong>"Home Page JigoShop Template"</strong> to your home remember that, in any case, it will load the <strong>Sidebar - Front Page </strong>.</li>
|
||||
<li><strong>Sidebar - WooCommerce </strong> - This sidebar will be loaded in every page belonging to the <strong>WooCommerce</strong> plugin <small>(shop, cart, products, product categories, etc.)</small>. If you have set the <strong>"Home Page WooCommerce Template"</strong> to your home remember that, in any case, it will load the <strong>Sidebar - Front Page </strong>.</li>
|
||||
<li><strong>Sidebar - Pages </strong> - This sidebar will be loaded in every page.</li>
|
||||
<li><strong>After Page Content</strong> - This widgets area will be loaded after the content of each page.</li>
|
||||
<li><strong>Sidebar - Blog</strong> - This sidebar will be loaded by every page belonging to the main blog, blog archives and in every blog post detail page.</li>
|
||||
<li><strong>After Blog Post Content</strong> - This widgets area will be loaded after the content of each blog post.</li>
|
||||
<li><strong>Sidebar - Portfolio</strong> - This sidebar will be loaded in every portfolio page and work post detail page.</li>
|
||||
<li><strong>After Work Content</strong> - This widgets area will be loaded after the content of each work post.</li>
|
||||
<li><strong>Sidebar - Search</strong> - This sidebar will be loaded only in the <strong>search results</strong> pages.</li>
|
||||
<li><strong>Sidebar - 404</strong> - This sidebar will be loaded only in the <strong>404 not found</strong> error page.</li>
|
||||
<li><strong>Sidebar - Home Agency (Slider - Left - Middle - Right)</strong> - These widgets areas are all dedicated to the <strong>"Home Page Agency Template"</strong></li>
|
||||
<li><strong>Sidebar - Home Business (Left - Middle - Right)</strong> - These widgets areas are all dedicated to the <strong>"Home Page Business Template"</strong></li>
|
||||
<li><strong>Sidebar - Home Freelance (Left - Middle - Right)</strong> - These widgets areas are all dedicated to the <strong>"Home Page Freelance Template"</strong></li>
|
||||
<li><strong>Sidebar - Home Standard (Left - Right)</strong> - These widgets areas are all dedicated to the <strong>"Home Page Standard Template"</strong></li>
|
||||
<li><strong>Sidebar - Home JigoShop (Left - Right)</strong> - These widgets areas are all dedicated to the <strong>"Home Page JigoShop Template"</strong></li>
|
||||
<li><strong>Sidebar - Home WooCommerce (Left - Right)</strong> - These widgets areas are all dedicated to the <strong>"Home Page WooCommerce Template"</strong></li>
|
||||
<li><strong>Footer Column (1, 2, 3, 4, 5, 6)</strong> - These widgets areas are all dedicated to the footer. They will be loaded depending on the footer layout that you set in the <strong>"Footer"</strong> tab of the <a href="themes.php?page=ot-theme-options" target="_self">Theme Options</a>.</li>
|
||||
</ol>
|
||||
</p>
|
||||
<p>For each page you can create an unique custom sidebar and widgets area that will be loaded and displayed only that page. You can also disable the default sidebars for the selected poage. Check the <strong>"Custom sidebars"</strong> tab of the <a href="themes.php?page=ot-theme-options" target="_self">Theme Options</a>.</p>
|
||||
|
||||
|
||||
<br />
|
||||
<small><a href="#docs_table_of_contents">^ Back to menu ^</a></small><span id="the_html_generator"></span>
|
||||
<h1>The HTML Generator</h1>
|
||||
<p>Below the editor of each page/post/work you will find the <strong>HTML Generator</strong>:<br /><br /><img src="<?php echo PK_THEME_DIR; ?>/framework/docs/images/html_generator.png" /></p>
|
||||
<p>You can use this tool to generate the necessary HTML code to recreate the components and elements listed under the <strong>"Shortcodes"</strong> section of the <a href="http://sold.parkerandkent.com/sold/" target="_blank">theme's preview</a>.</p>
|
||||
<p>Remember to generate the HTML code of each component in this way:
|
||||
<ol>
|
||||
<li>Switch to the <strong>"HTML Tab"</strong> <small>(not the visual one)</small> of the page/post/work editor.</li>
|
||||
<li>Put the cursor in the position where you want the generated code to be placed within your contents.</li>
|
||||
<li>Select the element/component you want from the <strong>HTML Generator</strong> list.</li>
|
||||
<li>Fill in the required fields and click on the "Generate HTML" button and you'll see the code added to the editor.</li>
|
||||
</ol>
|
||||
</p>
|
||||
|
||||
|
||||
<br />
|
||||
<small><a href="#docs_table_of_contents">^ Back to menu ^</a></small><span id="theme_translation"></span>
|
||||
<h1>Theme Translation</h1>
|
||||
<p>This theme is localized. This means that it is translation-ready. To translate, follow these instructions:</p>
|
||||
<ol>
|
||||
<li>If not already done, convert your WordPress install to the preferred language. Check this <a href="http://codex.wordpress.org/WordPress_in_Your_Language" target="_blank">link</a> for more info.</li>
|
||||
<li>Download <a href="http://www.poedit.net/download.php" target="_blank">PoEdit</a> or a similar software.</li>
|
||||
<li>Open the file pk_translate.po located in the pk2012_sold/translate/ folder using PoEdit.</li>
|
||||
<li>Enter a translation for any string you need.</li>
|
||||
<li>Once you have finished, save the file twice, once as .po and once as .mo, the filename should be your language code. Example: it_IT.po and it_IT.mo for Italian. See the language codes <a href="http://codex.wordpress.org/WordPress_in_Your_Language" target="_blank">here</a>.</li>
|
||||
<li>Save and upload these files in the same folder where the original pk_translate.po is located. Your theme will be localized.</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
function pk_add_theme_docs_page() {
|
||||
|
||||
add_theme_page(__('Theme Docs', 'pk_translate'), __('Theme Docs', 'pk_translate'), 'edit_posts', basename(__FILE__), 'pk_create_theme_docs_page');
|
||||
|
||||
}
|
||||
|
||||
add_action('admin_menu', 'pk_add_theme_docs_page');
|
||||
|
||||
?>
|
@ -0,0 +1,386 @@
|
||||
<?php
|
||||
/**
|
||||
* jsmin.php - PHP implementation of Douglas Crockford's JSMin.
|
||||
*
|
||||
* This is pretty much a direct port of jsmin.c to PHP with just a few
|
||||
* PHP-specific performance tweaks. Also, whereas jsmin.c reads from stdin and
|
||||
* outputs to stdout, this library accepts a string as input and returns another
|
||||
* string as output.
|
||||
*
|
||||
* PHP 5 or higher is required.
|
||||
*
|
||||
* Permission is hereby granted to use this version of the library under the
|
||||
* same terms as jsmin.c, which has the following license:
|
||||
*
|
||||
* --
|
||||
* Copyright (c) 2002 Douglas Crockford (www.crockford.com)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is furnished to do
|
||||
* so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* The Software shall be used for Good, not Evil.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
* --
|
||||
*
|
||||
* @package JSMin
|
||||
* @author Ryan Grove <ryan@wonko.com>
|
||||
* @copyright 2002 Douglas Crockford <douglas@crockford.com> (jsmin.c)
|
||||
* @copyright 2008 Ryan Grove <ryan@wonko.com> (PHP port)
|
||||
* @copyright 2012 Adam Goforth <aag@adamgoforth.com> (Updates)
|
||||
* @license http://opensource.org/licenses/mit-license.php MIT License
|
||||
* @version 1.1.2 (2012-05-01)
|
||||
* @link https://github.com/rgrove/jsmin-php
|
||||
*/
|
||||
|
||||
class JSMin {
|
||||
const ORD_LF = 10;
|
||||
const ORD_SPACE = 32;
|
||||
const ACTION_KEEP_A = 1;
|
||||
const ACTION_DELETE_A = 2;
|
||||
const ACTION_DELETE_A_B = 3;
|
||||
|
||||
protected $a = '';
|
||||
protected $b = '';
|
||||
protected $input = '';
|
||||
protected $inputIndex = 0;
|
||||
protected $inputLength = 0;
|
||||
protected $lookAhead = null;
|
||||
protected $output = '';
|
||||
|
||||
// -- Public Static Methods --------------------------------------------------
|
||||
|
||||
/**
|
||||
* Minify Javascript
|
||||
*
|
||||
* @uses __construct()
|
||||
* @uses min()
|
||||
* @param string $js Javascript to be minified
|
||||
* @return string
|
||||
*/
|
||||
public static function minify($js) {
|
||||
$jsmin = new JSMin($js);
|
||||
return $jsmin->min();
|
||||
}
|
||||
|
||||
// -- Public Instance Methods ------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $input Javascript to be minified
|
||||
*/
|
||||
public function __construct($input) {
|
||||
$this->input = str_replace("\r\n", "\n", $input);
|
||||
$this->inputLength = strlen($this->input);
|
||||
}
|
||||
|
||||
// -- Protected Instance Methods ---------------------------------------------
|
||||
|
||||
/**
|
||||
* Action -- do something! What to do is determined by the $command argument.
|
||||
*
|
||||
* action treats a string as a single character. Wow!
|
||||
* action recognizes a regular expression if it is preceded by ( or , or =.
|
||||
*
|
||||
* @uses next()
|
||||
* @uses get()
|
||||
* @throws JSMinException If parser errors are found:
|
||||
* - Unterminated string literal
|
||||
* - Unterminated regular expression set in regex literal
|
||||
* - Unterminated regular expression literal
|
||||
* @param int $command One of class constants:
|
||||
* ACTION_KEEP_A Output A. Copy B to A. Get the next B.
|
||||
* ACTION_DELETE_A Copy B to A. Get the next B. (Delete A).
|
||||
* ACTION_DELETE_A_B Get the next B. (Delete B).
|
||||
*/
|
||||
protected function action($command) {
|
||||
switch($command) {
|
||||
case self::ACTION_KEEP_A:
|
||||
$this->output .= $this->a;
|
||||
|
||||
case self::ACTION_DELETE_A:
|
||||
$this->a = $this->b;
|
||||
|
||||
if ($this->a === "'" || $this->a === '"') {
|
||||
for (;;) {
|
||||
$this->output .= $this->a;
|
||||
$this->a = $this->get();
|
||||
|
||||
if ($this->a === $this->b) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (ord($this->a) <= self::ORD_LF) {
|
||||
throw new JSMinException('Unterminated string literal.');
|
||||
}
|
||||
|
||||
if ($this->a === '\\') {
|
||||
$this->output .= $this->a;
|
||||
$this->a = $this->get();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case self::ACTION_DELETE_A_B:
|
||||
$this->b = $this->next();
|
||||
|
||||
if ($this->b === '/' && (
|
||||
$this->a === '(' || $this->a === ',' || $this->a === '=' ||
|
||||
$this->a === ':' || $this->a === '[' || $this->a === '!' ||
|
||||
$this->a === '&' || $this->a === '|' || $this->a === '?' ||
|
||||
$this->a === '{' || $this->a === '}' || $this->a === ';' ||
|
||||
$this->a === "\n" )) {
|
||||
|
||||
$this->output .= $this->a . $this->b;
|
||||
|
||||
for (;;) {
|
||||
$this->a = $this->get();
|
||||
|
||||
if ($this->a === '[') {
|
||||
/*
|
||||
inside a regex [...] set, which MAY contain a '/' itself. Example: mootools Form.Validator near line 460:
|
||||
return Form.Validator.getValidator('IsEmpty').test(element) || (/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]\.?){0,63}[a-z0-9!#$%&'*+/=?^_`{|}~-]@(?:(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\])$/i).test(element.get('value'));
|
||||
*/
|
||||
for (;;) {
|
||||
$this->output .= $this->a;
|
||||
$this->a = $this->get();
|
||||
|
||||
if ($this->a === ']') {
|
||||
break;
|
||||
} elseif ($this->a === '\\') {
|
||||
$this->output .= $this->a;
|
||||
$this->a = $this->get();
|
||||
} elseif (ord($this->a) <= self::ORD_LF) {
|
||||
throw new JSMinException('Unterminated regular expression set in regex literal.');
|
||||
}
|
||||
}
|
||||
} elseif ($this->a === '/') {
|
||||
break;
|
||||
} elseif ($this->a === '\\') {
|
||||
$this->output .= $this->a;
|
||||
$this->a = $this->get();
|
||||
} elseif (ord($this->a) <= self::ORD_LF) {
|
||||
throw new JSMinException('Unterminated regular expression literal.');
|
||||
}
|
||||
|
||||
$this->output .= $this->a;
|
||||
}
|
||||
|
||||
$this->b = $this->next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get next char. Convert ctrl char to space.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
protected function get() {
|
||||
$c = $this->lookAhead;
|
||||
$this->lookAhead = null;
|
||||
|
||||
if ($c === null) {
|
||||
if ($this->inputIndex < $this->inputLength) {
|
||||
$c = substr($this->input, $this->inputIndex, 1);
|
||||
$this->inputIndex += 1;
|
||||
} else {
|
||||
$c = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($c === "\r") {
|
||||
return "\n";
|
||||
}
|
||||
|
||||
if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) {
|
||||
return $c;
|
||||
}
|
||||
|
||||
return ' ';
|
||||
}
|
||||
|
||||
/**
|
||||
* Is $c a letter, digit, underscore, dollar sign, or non-ASCII character.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isAlphaNum($c) {
|
||||
return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform minification, return result
|
||||
*
|
||||
* @uses action()
|
||||
* @uses isAlphaNum()
|
||||
* @uses get()
|
||||
* @uses peek()
|
||||
* @return string
|
||||
*/
|
||||
protected function min() {
|
||||
if (0 == strncmp($this->peek(), "\xef", 1)) {
|
||||
$this->get();
|
||||
$this->get();
|
||||
$this->get();
|
||||
}
|
||||
|
||||
$this->a = "\n";
|
||||
$this->action(self::ACTION_DELETE_A_B);
|
||||
|
||||
while ($this->a !== null) {
|
||||
switch ($this->a) {
|
||||
case ' ':
|
||||
if ($this->isAlphaNum($this->b)) {
|
||||
$this->action(self::ACTION_KEEP_A);
|
||||
} else {
|
||||
$this->action(self::ACTION_DELETE_A);
|
||||
}
|
||||
break;
|
||||
|
||||
case "\n":
|
||||
switch ($this->b) {
|
||||
case '{':
|
||||
case '[':
|
||||
case '(':
|
||||
case '+':
|
||||
case '-':
|
||||
case '!':
|
||||
case '~':
|
||||
$this->action(self::ACTION_KEEP_A);
|
||||
break;
|
||||
|
||||
case ' ':
|
||||
$this->action(self::ACTION_DELETE_A_B);
|
||||
break;
|
||||
|
||||
default:
|
||||
if ($this->isAlphaNum($this->b)) {
|
||||
$this->action(self::ACTION_KEEP_A);
|
||||
}
|
||||
else {
|
||||
$this->action(self::ACTION_DELETE_A);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
switch ($this->b) {
|
||||
case ' ':
|
||||
if ($this->isAlphaNum($this->a)) {
|
||||
$this->action(self::ACTION_KEEP_A);
|
||||
break;
|
||||
}
|
||||
|
||||
$this->action(self::ACTION_DELETE_A_B);
|
||||
break;
|
||||
|
||||
case "\n":
|
||||
switch ($this->a) {
|
||||
case '}':
|
||||
case ']':
|
||||
case ')':
|
||||
case '+':
|
||||
case '-':
|
||||
case '"':
|
||||
case "'":
|
||||
$this->action(self::ACTION_KEEP_A);
|
||||
break;
|
||||
|
||||
default:
|
||||
if ($this->isAlphaNum($this->a)) {
|
||||
$this->action(self::ACTION_KEEP_A);
|
||||
}
|
||||
else {
|
||||
$this->action(self::ACTION_DELETE_A_B);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->action(self::ACTION_KEEP_A);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the next character, skipping over comments. peek() is used to see
|
||||
* if a '/' is followed by a '/' or '*'.
|
||||
*
|
||||
* @uses get()
|
||||
* @uses peek()
|
||||
* @throws JSMinException On unterminated comment.
|
||||
* @return string
|
||||
*/
|
||||
protected function next() {
|
||||
$c = $this->get();
|
||||
|
||||
if ($c === '/') {
|
||||
switch($this->peek()) {
|
||||
case '/':
|
||||
for (;;) {
|
||||
$c = $this->get();
|
||||
|
||||
if (ord($c) <= self::ORD_LF) {
|
||||
return $c;
|
||||
}
|
||||
}
|
||||
|
||||
case '*':
|
||||
$this->get();
|
||||
|
||||
for (;;) {
|
||||
switch($this->get()) {
|
||||
case '*':
|
||||
if ($this->peek() === '/') {
|
||||
$this->get();
|
||||
return ' ';
|
||||
}
|
||||
break;
|
||||
|
||||
case null:
|
||||
throw new JSMinException('Unterminated comment.');
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
return $c;
|
||||
}
|
||||
}
|
||||
|
||||
return $c;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get next char. If is ctrl character, translate to a space or newline.
|
||||
*
|
||||
* @uses get()
|
||||
* @return string|null
|
||||
*/
|
||||
protected function peek() {
|
||||
$this->lookAhead = $this->get();
|
||||
return $this->lookAhead;
|
||||
}
|
||||
}
|
||||
|
||||
// -- Exceptions ---------------------------------------------------------------
|
||||
class JSMinException extends Exception {}
|
||||
?>
|
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
if (!class_exists('pk_admin')) {
|
||||
|
||||
class pk_admin {
|
||||
|
||||
function pk_admin() {
|
||||
|
||||
require_once(PK_FRAMEWORK.'/docs/pk_docs.php');
|
||||
require_once(PK_FRAMEWORK.'/shortcodes/pk_shortcodes.php');
|
||||
require_once(PK_FRAMEWORK.'/pk_admin_setup.php');
|
||||
require_once(PK_FRAMEWORK.'/pk_metaboxes.php');
|
||||
require_once(PK_FRAMEWORK.'/pk_options.php');
|
||||
require_once(PK_FRAMEWORK.'/pk_plugins.php');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (class_exists('pk_admin') && !isset($admin_instance)) {
|
||||
|
||||
$admin_instance = new pk_admin();
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
function pk_enqueue_admin_scripts() {
|
||||
|
||||
wp_enqueue_script('jquery');
|
||||
|
||||
wp_enqueue_script('jquery-ui-sortable');
|
||||
|
||||
if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'pk_portfolio.php') {
|
||||
|
||||
wp_deregister_script('pk_sortable_portfolio');
|
||||
wp_register_script('pk_sortable_portfolio', PK_THEME_DIR.'/js/pk_sortable_portfolio.js');
|
||||
wp_enqueue_script('pk_sortable_portfolio');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
add_action('admin_init', 'pk_enqueue_admin_scripts');
|
||||
|
||||
function pk_enqueue_admin_styles() {
|
||||
|
||||
if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'pk_portfolio.php') {
|
||||
|
||||
wp_enqueue_style('pk_sort', PK_THEME_DIR.'/css/pk_sort.css');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
add_action('admin_init', 'pk_enqueue_admin_styles');
|
||||
|
||||
function pk_admin_head() {
|
||||
|
||||
echo '<style> #option-tree-version { visibility:hidden; } .option-tree-save-layout{ display:none; } </style>';
|
||||
|
||||
}
|
||||
|
||||
add_action('admin_head', 'pk_admin_head');
|
||||
|
||||
?>
|
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
remove_action('jigoshop_sidebar', 'jigoshop_get_sidebar');
|
||||
remove_action('jigoshop_before_main_content', 'jigoshop_breadcrumb', 20, 0);
|
||||
|
||||
remove_action('woocommerce_sidebar', 'woocommerce_get_sidebar');
|
||||
remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0);
|
||||
|
||||
function pk_ecommerce_after_main_content() {
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("a.zoom").attr('rel', "prettyPhoto[thumbnails]").prettyPhoto(<?php echo PK_PRETTYPHOTO_PARAMS; ?>);
|
||||
jQuery('#review_form_wrapper').hide();
|
||||
jQuery('a.show_review_form').pk_review_form({
|
||||
button_close_label:"<?php _e('Cancel', 'pk_translate'); ?>"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
add_action('jigoshop_after_main_content', 'pk_ecommerce_after_main_content');
|
||||
add_action('woocommerce_after_main_content', 'pk_ecommerce_after_main_content');
|
||||
|
||||
if (!function_exists('loop_columns')) {
|
||||
|
||||
function loop_columns() {
|
||||
|
||||
return 3;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (function_exists('is_woocommerce')) add_filter('loop_shop_columns', 'loop_columns');
|
||||
|
||||
if (function_exists('is_woocommerce')) add_filter('loop_shop_per_page', create_function('$cols', 'return 9;'));
|
||||
|
||||
function pk_woocommerce_set_body_class($classes) {
|
||||
|
||||
if (function_exists('woocommerce_get_page_id') && woocommerce_get_page_id('thanks') == get_the_ID()) $classes[] = 'woocommerce-thankyou';
|
||||
return $classes;
|
||||
|
||||
}
|
||||
|
||||
add_filter('body_class','pk_woocommerce_set_body_class');
|
||||
|
||||
?>
|
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
function pk_register_faq() {
|
||||
|
||||
$labels = array(
|
||||
'name' => _x('FAQ', 'post type general name', 'pk_translate'),
|
||||
'singular_name' => _x('FAQ', 'post type singular name', 'pk_translate'),
|
||||
'add_new' => _x('Add New FAQ', 'release', 'pk_translate'),
|
||||
'add_new_item' => __('Add New FAQ', 'pk_translate'),
|
||||
'edit_item' => __('Edit FAQ', 'pk_translate'),
|
||||
'new_item' => __('New FAQ', 'pk_translate'),
|
||||
'view_item' => __('View FAQ', 'pk_translate'),
|
||||
'search_items' => __('Search FAQs', 'pk_translate'),
|
||||
'not_found' => __('No FAQs found', 'pk_translate'),
|
||||
'not_found_in_trash' => __('No FAQs found in Trash', 'pk_translate')
|
||||
);
|
||||
|
||||
$args = array(
|
||||
'labels' => $labels,
|
||||
'public' => true,
|
||||
'menu_position' => 5,
|
||||
'capability_type' => 'page',
|
||||
'hierarchical' => false,
|
||||
'supports' => array('title', 'editor', 'page-attributes'),
|
||||
'query_var' => true,
|
||||
'rewrite' => array('slug' => 'faq', 'with_front' => false),
|
||||
'show_in_nav_menus' => false,
|
||||
'has_archive' => false
|
||||
);
|
||||
|
||||
register_post_type('faq', $args);
|
||||
|
||||
flush_rewrite_rules();
|
||||
|
||||
}
|
||||
|
||||
add_action('init', 'pk_register_faq');
|
||||
|
||||
?>
|
@ -0,0 +1,557 @@
|
||||
<?php
|
||||
|
||||
function pk_highlight_search_results($content) {
|
||||
|
||||
$s = esc_html(get_search_query());
|
||||
|
||||
if (!$s) return $content;
|
||||
|
||||
$s = trim(ereg_replace(' +', ' ', $s));
|
||||
|
||||
$keys = explode(' ', $s);
|
||||
|
||||
return preg_replace('/('.implode('|', $keys).')/iu', '<span class="pk_highlight">\0</span>', $content);
|
||||
|
||||
}
|
||||
|
||||
function pk_add_post_types_to_author_page_query_string($query_string) {
|
||||
|
||||
if (isset($query_string['author_name'])) $query_string['post_type'] = array('page', 'post', 'portfolio', 'faq', 'product');
|
||||
|
||||
return $query_string;
|
||||
|
||||
}
|
||||
|
||||
add_filter('request', 'pk_add_post_types_to_author_page_query_string');
|
||||
|
||||
function pk_change_wp_login_url() {
|
||||
|
||||
return home_url();
|
||||
|
||||
}
|
||||
|
||||
add_filter('login_headerurl', 'pk_change_wp_login_url');
|
||||
|
||||
function pk_change_wp_login_title() {
|
||||
|
||||
return 'Powered by '.get_bloginfo('name');
|
||||
|
||||
}
|
||||
|
||||
add_filter('login_headertitle', 'pk_change_wp_login_title');
|
||||
|
||||
function pk_redirect_after_login($redirect_to, $request, $user) {
|
||||
|
||||
if (isset($user -> roles) && is_array($user -> roles )) {
|
||||
|
||||
if (in_array('administrator', $user -> roles))
|
||||
return home_url( '/wp-admin/' );
|
||||
else
|
||||
return $_SERVER[HTTP_REFERER];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
add_filter('login_redirect', 'pk_redirect_after_login', 10, 3);
|
||||
|
||||
function pk_redirect_after_logout() {
|
||||
|
||||
wp_redirect(home_url());
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
add_filter('wp_logout', 'pk_redirect_after_logout');
|
||||
|
||||
function pk_pre_get_posts($query) {
|
||||
|
||||
if (is_admin() || is_singular()) {
|
||||
|
||||
return $query;
|
||||
|
||||
}
|
||||
|
||||
if ((is_home() || is_archive() || is_search() || is_author()) && !is_tax() && !is_post_type_archive() && !is_feed()) {
|
||||
|
||||
$query -> set('posts_per_page', (int)pk_get_option('blog_layout', '10') * (int)pk_get_option('blog_layout_rows', '1'));
|
||||
|
||||
return $query;
|
||||
|
||||
}
|
||||
|
||||
if (is_tax('taxonomy_portfolio') || is_post_type_archive('portfolio')) {
|
||||
|
||||
$query -> set('posts_per_page', (int)pk_get_option('portfolio_layout', '4') * (int)pk_get_option('portfolio_layout_rows', '3'));
|
||||
|
||||
return $query;
|
||||
|
||||
}
|
||||
|
||||
return $query;
|
||||
|
||||
}
|
||||
|
||||
add_filter('pre_get_posts', 'pk_pre_get_posts');
|
||||
|
||||
function pk_blog_excerpt_filter($length) {
|
||||
|
||||
return 30;
|
||||
|
||||
}
|
||||
|
||||
function pk_grid_excerpt_filter($length) {
|
||||
|
||||
return 15;
|
||||
|
||||
}
|
||||
|
||||
function pk_widgets_excerpt_filter($length) {
|
||||
|
||||
return 15;
|
||||
|
||||
}
|
||||
|
||||
function pk_excerpt_more($more) {
|
||||
|
||||
return '…';
|
||||
|
||||
}
|
||||
|
||||
add_filter('excerpt_more', 'pk_excerpt_more');
|
||||
|
||||
function pk_portfolio_embed_defaults($embed_size){
|
||||
|
||||
$embed_size['width'] = (pk_sidebar()) ? 580 : 940;
|
||||
|
||||
return $embed_size;
|
||||
|
||||
}
|
||||
|
||||
function pk_blog_embed_defaults($embed_size){
|
||||
|
||||
$embed_size['width'] = (pk_sidebar()) ? 580 : 940;
|
||||
|
||||
return $embed_size;
|
||||
|
||||
}
|
||||
|
||||
function pk_post_embed_defaults($embed_size){
|
||||
|
||||
$embed_size['width'] = (pk_sidebar()) ? 490 : 850;
|
||||
|
||||
return $embed_size;
|
||||
|
||||
}
|
||||
|
||||
function pk_full_width_page_embed_defaults($embed_size){
|
||||
|
||||
$embed_size['width'] = 940;
|
||||
|
||||
return $embed_size;
|
||||
|
||||
}
|
||||
|
||||
function pk_page_embed_defaults($embed_size){
|
||||
|
||||
$embed_size['width'] = (is_page_template('page-full-width.php')) ? 940 : 580;
|
||||
|
||||
return $embed_size;
|
||||
|
||||
}
|
||||
|
||||
function pk_faq_page_embed_defaults($embed_size){
|
||||
|
||||
$embed_size['width'] = 870;
|
||||
|
||||
return $embed_size;
|
||||
|
||||
}
|
||||
|
||||
function pk_categories_widget($categories_args) {
|
||||
|
||||
$categories_args['title_li'] = '';
|
||||
|
||||
return $categories_args;
|
||||
|
||||
}
|
||||
|
||||
add_filter('widget_categories_args', 'pk_categories_widget');
|
||||
|
||||
function pk_embed_oembed_html($html, $url, $attr, $post_id) {
|
||||
|
||||
return '<div class="pk_video">'.$html.'</div>';
|
||||
|
||||
}
|
||||
|
||||
add_filter('embed_oembed_html', 'pk_embed_oembed_html', 99, 4);
|
||||
|
||||
function pk_exclude_from_gallery_fields($attachment) {
|
||||
|
||||
$value = get_post_meta($attachment -> ID, '_exclude_from_gallery', true);
|
||||
|
||||
if (!isset($value) || $value == '') $value = 'no';
|
||||
|
||||
return "<input type='radio' name='attachments[{$attachment -> ID}][exclude_from_gallery]' id='exclude_from_gallery_{$attachment -> ID}' value='yes'".('yes' == $value ? " checked='checked'" : "")." /><label for='exclude_from_gallery_{$attachment -> ID}'>".__('Yes', 'pk_translate')."</label><input type='radio' name='attachments[{$attachment -> ID}][exclude_from_gallery]' id='exclude_from_gallery_{$attachment -> ID}' value='no'".('no' == $value ? " checked='checked'" : "")." /><label for='exclude_from_gallery_{$attachment -> ID}'>".__('No', 'pk_translate')."</label>";
|
||||
|
||||
}
|
||||
|
||||
function pk_attachment_fields($form_fields, $attachment) {
|
||||
|
||||
$form_fields['exclude_from_gallery'] = array(
|
||||
'label' => __('Exclude from gallery', 'pk_translate'),
|
||||
'input' => 'html',
|
||||
'html' => pk_exclude_from_gallery_fields($attachment),
|
||||
'helps' => __('Select to exclude or not this image from the post\'s gallery..', 'pk_translate')
|
||||
);
|
||||
|
||||
$form_fields['image_link'] = array(
|
||||
'label' => __('Image Custom Link', 'pk_translate'),
|
||||
'input' => 'text',
|
||||
'value' => get_post_meta($attachment -> ID, '_image_link', true),
|
||||
'helps' => __('Add a custom link, internal or external, to open on click over the image.', 'pk_translate')
|
||||
);
|
||||
|
||||
$form_fields['image_link_target'] = array(
|
||||
'label' => __('Image Custom Link Target', 'pk_translate'),
|
||||
'input' => 'text',
|
||||
'value' => get_post_meta($attachment -> ID, '_image_link_target', true),
|
||||
'helps' => __('Add the custom link target, "_self" or "_blank". If unset the default value will be "_self".', 'pk_translate')
|
||||
);
|
||||
|
||||
$form_fields['video_url'] = array(
|
||||
'label' => __('Video URL', 'pk_translate'),
|
||||
'input' => 'text',
|
||||
'value' => get_post_meta($attachment -> ID, '_video_url', true),
|
||||
'helps' => __('Add video URL (YouTube, Vimeo, DailyMotion, MetaCafe, Twitvid).', 'pk_translate')
|
||||
);
|
||||
|
||||
$form_fields['video_urls'] = array(
|
||||
'label' => __('Video File/s', 'pk_translate'),
|
||||
'input' => 'text',
|
||||
'value' => get_post_meta($attachment -> ID, '_video_urls', true),
|
||||
'helps' => __('Add video file/s URL: m4v (mandatory), ogv, webmv, flv. Enter a comma separated list of different formats of the same video file, for the best cross browser compatibility.', 'pk_translate')
|
||||
);
|
||||
|
||||
$form_fields['audio_urls'] = array(
|
||||
'label' => __('Audio File/s', 'pk_translate'),
|
||||
'input' => 'text',
|
||||
'value' => get_post_meta($attachment -> ID, '_audio_urls', true),
|
||||
'helps' => __('Add audio file/s URL: mp3 (mandatory), m4a (mandatory), oga, webma, wav, fla. Enter a comma separated list of different formats of the same audio file, for the best cross browser compatibility.', 'pk_translate')
|
||||
);
|
||||
|
||||
$form_fields['title_properties'] = array(
|
||||
'label' => __('Title Properties', 'pk_translate'),
|
||||
'input' => 'textarea',
|
||||
'value' => get_post_meta($attachment -> ID, '_title_properties', true),
|
||||
'helps' => __('Add slide title properties. This option is used only by homepages sliders. Example: <strong>{\'x\':\'100\', \'y\':\'100\', \'width\':\'350\', \'color\':\'#ffffff\', \'bg_color\':\'#000000\'}</strong>', 'pk_translate')
|
||||
);
|
||||
|
||||
$form_fields['description_properties'] = array(
|
||||
'label' => __('Description Properties', 'pk_translate'),
|
||||
'input' => 'textarea',
|
||||
'value' => get_post_meta($attachment -> ID, '_description_properties', true),
|
||||
'helps' => __('Add slide description properties. This option is used only by homepages sliders. Example: <strong>{\'x\':\'100\', \'y\':\'150\', \'width\':\'350\', \'color\':\'#ffffff\', \'bg_color\':\'#000000\'}</strong>', 'pk_translate')
|
||||
);
|
||||
|
||||
$form_fields['snap_points'] = array(
|
||||
'label' => __('Snap Points', 'pk_translate'),
|
||||
'input' => 'textarea',
|
||||
'value' => get_post_meta($attachment -> ID, '_snap_points', true),
|
||||
'helps' => __('Add image snap points. This option is used only by homepages sliders.', 'pk_translate')
|
||||
);
|
||||
|
||||
return $form_fields;
|
||||
|
||||
}
|
||||
|
||||
add_filter('attachment_fields_to_edit', 'pk_attachment_fields', 10, 2);
|
||||
|
||||
function pk_attachment_fields_save($post, $attachment) {
|
||||
|
||||
if (isset($attachment['exclude_from_gallery'])) update_post_meta($post['ID'], '_exclude_from_gallery', $attachment['exclude_from_gallery']);
|
||||
if (isset($attachment['image_link'])) update_post_meta($post['ID'], '_image_link', $attachment['image_link']);
|
||||
if (isset($attachment['image_link_target'])) update_post_meta($post['ID'], '_image_link_target', $attachment['image_link_target']);
|
||||
if (isset($attachment['video_url'])) update_post_meta($post['ID'], '_video_url', $attachment['video_url']);
|
||||
if (isset($attachment['video_urls'])) update_post_meta($post['ID'], '_video_urls', $attachment['video_urls']);
|
||||
if (isset($attachment['audio_urls'])) update_post_meta($post['ID'], '_audio_urls', $attachment['audio_urls']);
|
||||
if (isset($attachment['title_properties'])) update_post_meta($post['ID'], '_title_properties', $attachment['title_properties']);
|
||||
if (isset($attachment['description_properties'])) update_post_meta($post['ID'], '_description_properties', $attachment['description_properties']);
|
||||
if (isset($attachment['snap_points'])) update_post_meta($post['ID'], '_snap_points', $attachment['snap_points']);
|
||||
|
||||
return $post;
|
||||
|
||||
}
|
||||
|
||||
add_filter('attachment_fields_to_save', 'pk_attachment_fields_save', 10, 2);
|
||||
|
||||
function pk_wmode_transparent($html, $url, $args) {
|
||||
|
||||
if (strpos($html, '<param name="movie"') !== false) $html = preg_replace('|</param>|', '</param><param name="wmode" value="transparent"></param>', $html, 1);
|
||||
if (strpos($html, '<embed') !== false) $html = str_replace('<embed', '<embed wmode="transparent"', $html);
|
||||
|
||||
return $html;
|
||||
|
||||
}
|
||||
|
||||
add_filter('oembed_result', 'pk_wmode_transparent', 10, 3);
|
||||
|
||||
function pk_add_custom_field_automatically($post_id) {
|
||||
|
||||
$post_type = get_post_type($post_id);
|
||||
$post_format = '';
|
||||
|
||||
if ($post_type == 'post') $post_format = (!get_post_format($post_id)) ? 'standard' : get_post_format($post_id);
|
||||
if ($post_type == 'portfolio') $post_format = get_post_meta($post_id, '_work_format', true);
|
||||
|
||||
if ($post_type == 'page') {
|
||||
|
||||
$post_template = get_post_meta($post_id, '_wp_page_template', true);
|
||||
|
||||
if (in_array($post_template, array('page-blog.php', 'page-portfolio.php', 'page-faq.php', 'page-home-agency.php', 'page-home-business.php', 'page-home-freelance.php', 'page-home-standard.php', 'page-home-jigoshop.php', 'page-home-woocommerce.php'))) {
|
||||
|
||||
$post_format = $post_template;
|
||||
|
||||
} else {
|
||||
|
||||
$post_format = get_post_meta($post_id, '_page_format', true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!wp_is_post_revision($post_id)) {
|
||||
|
||||
if ($post_type == 'post') add_post_meta($post_id, '_sidebar', 'show', true);
|
||||
if ($post_type == 'portfolio') add_post_meta($post_id, '_sidebar', 'show', true);
|
||||
if ($post_type == 'product') add_post_meta($post_id, '_sidebar', 'show', true);
|
||||
|
||||
if ($post_type == 'post' && $post_format == 'link') add_post_meta($post_id, '_link', '#', true);
|
||||
if ($post_type == 'post' && $post_format == 'quote') add_post_meta($post_id, '_quote', 'Enter the quote text in the dedicated custom field. Edit this post to change this value!', true);
|
||||
if ($post_type == 'post' && $post_format == 'quote') add_post_meta($post_id, '_cite', 'parker&kent team', true);
|
||||
if ($post_type == 'post' && $post_format == 'gallery') add_post_meta($post_id, '_slider_info_button_open_label', 'info', true);
|
||||
if ($post_type == 'post' && $post_format == 'gallery') add_post_meta($post_id, '_slider_info_button_close_label', 'close info', true);
|
||||
if ($post_type == 'post' && $post_format == 'gallery') add_post_meta($post_id, '_slider_slideshow', 'true', true);
|
||||
if ($post_type == 'post' && $post_format == 'gallery') add_post_meta($post_id, '_slider_slideshow_auto_start', 'false', true);
|
||||
if ($post_type == 'post' && $post_format == 'gallery') add_post_meta($post_id, '_slider_slideshow_interval', '5', true);
|
||||
|
||||
if ($post_type == 'portfolio' && $post_format == 'slider') add_post_meta($post_id, '_slider_info_button_open_label', 'info', true);
|
||||
if ($post_type == 'portfolio' && $post_format == 'slider') add_post_meta($post_id, '_slider_info_button_close_label', 'close info', true);
|
||||
if ($post_type == 'portfolio' && $post_format == 'slider') add_post_meta($post_id, '_slideshow', 'true', true);
|
||||
if ($post_type == 'portfolio' && $post_format == 'slider') add_post_meta($post_id, '_slider_slideshow_auto_start', 'false', true);
|
||||
if ($post_type == 'portfolio' && $post_format == 'slider') add_post_meta($post_id, '_slider_slideshow_interval', '5', true);
|
||||
|
||||
if ($post_type == 'page' && $post_format == 'slider') add_post_meta($post_id, '_slider_info_button_open_label', 'info', true);
|
||||
if ($post_type == 'page' && $post_format == 'slider') add_post_meta($post_id, '_slider_info_button_close_label', 'close info', true);
|
||||
if ($post_type == 'page' && $post_format == 'slider') add_post_meta($post_id, '_slider_slideshow', 'true', true);
|
||||
if ($post_type == 'page' && $post_format == 'slider') add_post_meta($post_id, '_slider_slideshow_auto_start', 'false', true);
|
||||
if ($post_type == 'page' && $post_format == 'slider') add_post_meta($post_id, '_slider_slideshow_interval', '5', true);
|
||||
|
||||
if ($post_type == 'page' && $post_format == 'page-faq.php') add_post_meta($post_id, '_faq_type', 'accordion', true);
|
||||
|
||||
if ($post_type == 'page' && $post_format == 'page-blog.php') add_post_meta($post_id, '_sidebar', 'show', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-blog.php') add_post_meta($post_id, '_grid_layout', 'normal', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-blog.php') add_post_meta($post_id, '_columns', '1', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-blog.php') add_post_meta($post_id, '_rows', '10', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-blog.php') add_post_meta($post_id, '_show_categories_filter', 'false', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-blog.php') add_post_meta($post_id, '_blog_categories', '', true);
|
||||
|
||||
if ($post_type == 'page' && $post_format == 'page-portfolio.php') add_post_meta($post_id, '_sidebar', 'show', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-portfolio.php') add_post_meta($post_id, '_grid_layout', 'normal', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-portfolio.php') add_post_meta($post_id, '_columns', '4', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-portfolio.php') add_post_meta($post_id, '_rows', '3', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-portfolio.php') add_post_meta($post_id, '_show_categories_filter', 'false', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-portfolio.php') add_post_meta($post_id, '_portfolio_categories', '', true);
|
||||
|
||||
if ($post_type == 'page' && $post_format == 'page-home-agency.php') add_post_meta($post_id, '_slider_navigation_align', 'right', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-agency.php') add_post_meta($post_id, '_slider_transition', 'fade', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-agency.php') add_post_meta($post_id, '_slider_background', '', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-agency.php') add_post_meta($post_id, '_slider_slideshow_auto_start', 'true', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-agency.php') add_post_meta($post_id, '_slider_slideshow_interval', '7', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-agency.php') add_post_meta($post_id, '_total_works', '4', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-agency.php') add_post_meta($post_id, '_portfolio_categories', '', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-agency.php') add_post_meta($post_id, '_view_all_button_color', 'white', true);
|
||||
|
||||
if ($post_type == 'page' && $post_format == 'page-home-business.php') add_post_meta($post_id, '_slider_navigation_align', 'center', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-business.php') add_post_meta($post_id, '_slider_transition', 'fade', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-business.php') add_post_meta($post_id, '_slider_background', '', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-business.php') add_post_meta($post_id, '_slider_slideshow_auto_start', 'true', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-business.php') add_post_meta($post_id, '_slider_slideshow_interval', '7', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-business.php') add_post_meta($post_id, '_feed_url', 'http://rss.cnn.com/rss/edition_business.rss', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-business.php') add_post_meta($post_id, '_feed_total_items', '5', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-business.php') add_post_meta($post_id, '_tabs_button_color', 'white', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-business.php') add_post_meta($post_id, '_tabs_button_link', '#', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-business.php') add_post_meta($post_id, '_tabs_button_label', 'Button Label', true);
|
||||
|
||||
if ($post_type == 'page' && $post_format == 'page-home-freelance.php') add_post_meta($post_id, '_slider_navigation_align', 'center', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-freelance.php') add_post_meta($post_id, '_slider_transition', 'fade', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-freelance.php') add_post_meta($post_id, '_slider_background', '', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-freelance.php') add_post_meta($post_id, '_slider_slideshow_auto_start', 'true', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-freelance.php') add_post_meta($post_id, '_slider_slideshow_interval', '7', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-freelance.php') add_post_meta($post_id, '_call_to_action_text', 'Call to action text!', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-freelance.php') add_post_meta($post_id, '_total_works', '4', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-freelance.php') add_post_meta($post_id, '_portfolio_categories', '', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-freelance.php') add_post_meta($post_id, '_view_all_button_color', 'white', true);
|
||||
|
||||
if ($post_type == 'page' && $post_format == 'page-home-standard.php') add_post_meta($post_id, '_slider_navigation_align', 'left', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-standard.php') add_post_meta($post_id, '_slider_transition', 'fade', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-standard.php') add_post_meta($post_id, '_slider_background', '', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-standard.php') add_post_meta($post_id, '_slider_slideshow_auto_start', 'true', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-standard.php') add_post_meta($post_id, '_slider_slideshow_interval', '7', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-standard.php') add_post_meta($post_id, '_call_to_action_text', 'Call to action text!', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-standard.php') add_post_meta($post_id, '_call_to_action_button_color', 'white', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-standard.php') add_post_meta($post_id, '_call_to_action_button_link', '#', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-standard.php') add_post_meta($post_id, '_call_to_action_button_label', 'Button Label', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-standard.php') add_post_meta($post_id, '_total_works', '3', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-standard.php') add_post_meta($post_id, '_portfolio_categories', '', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-standard.php') add_post_meta($post_id, '_total_posts', '3', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-standard.php') add_post_meta($post_id, '_blog_categories', '', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-standard.php') add_post_meta($post_id, '_view_all_button_color', 'white', true);
|
||||
|
||||
if ($post_type == 'page' && $post_format == 'page-home-jigoshop.php') add_post_meta($post_id, '_slider_navigation_align', 'center', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-jigoshop.php') add_post_meta($post_id, '_slider_transition', 'fade', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-jigoshop.php') add_post_meta($post_id, '_slider_background', '', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-jigoshop.php') add_post_meta($post_id, '_slider_slideshow_auto_start', 'true', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-jigoshop.php') add_post_meta($post_id, '_slider_slideshow_interval', '7', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-jigoshop.php') add_post_meta($post_id, '_call_to_action_text', 'Call to action text!', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-jigoshop.php') add_post_meta($post_id, '_call_to_action_button_color', 'white', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-jigoshop.php') add_post_meta($post_id, '_call_to_action_button_link', ((function_exists('jigoshop_get_page_id')) ? get_permalink((function_exists('icl_object_id')) ? icl_object_id(jigoshop_get_page_id('shop'), 'page', true) : jigoshop_get_page_id('shop')) : '#'), true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-jigoshop.php') add_post_meta($post_id, '_call_to_action_button_label', 'Button Label', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-jigoshop.php') add_post_meta($post_id, '_total_recent_products', '2', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-jigoshop.php') add_post_meta($post_id, '_total_featured_products', '3', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-jigoshop.php') add_post_meta($post_id, '_view_all_button_color', 'white', true);
|
||||
|
||||
if ($post_type == 'page' && $post_format == 'page-home-woocommerce.php') add_post_meta($post_id, '_slider_navigation_align', 'center', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-woocommerce.php') add_post_meta($post_id, '_slider_transition', 'fade', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-woocommerce.php') add_post_meta($post_id, '_slider_background', '', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-woocommerce.php') add_post_meta($post_id, '_slider_slideshow_auto_start', 'true', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-woocommerce.php') add_post_meta($post_id, '_slider_slideshow_interval', '7', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-woocommerce.php') add_post_meta($post_id, '_call_to_action_text', 'Call to action text!', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-woocommerce.php') add_post_meta($post_id, '_call_to_action_button_color', 'white', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-woocommerce.php') add_post_meta($post_id, '_call_to_action_button_link', ((function_exists('woocommerce_get_page_id')) ? get_permalink((function_exists('icl_object_id')) ? icl_object_id(woocommerce_get_page_id('shop'), 'page', true) : woocommerce_get_page_id('shop')) : '#'), true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-woocommerce.php') add_post_meta($post_id, '_call_to_action_button_label', 'Button Label', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-woocommerce.php') add_post_meta($post_id, '_total_recent_products', '2', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-woocommerce.php') add_post_meta($post_id, '_total_featured_products', '3', true);
|
||||
if ($post_type == 'page' && $post_format == 'page-home-woocommerce.php') add_post_meta($post_id, '_view_all_button_color', 'white', true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
add_action('publish_page', 'pk_add_custom_field_automatically');
|
||||
add_action('update_page', 'pk_add_custom_field_automatically');
|
||||
add_action('publish_post', 'pk_add_custom_field_automatically');
|
||||
add_action('update_post', 'pk_add_custom_field_automatically');
|
||||
add_action('publish_portfolio', 'pk_add_custom_field_automatically');
|
||||
add_action('update_portfolio', 'pk_add_custom_field_automatically');
|
||||
add_action('publish_product', 'pk_add_custom_field_automatically');
|
||||
add_action('update_product', 'pk_add_custom_field_automatically');
|
||||
|
||||
function pk_ot_update_options($options) {
|
||||
|
||||
if (defined('ICL_LANGUAGE_CODE') && ICL_LANGUAGE_CODE != 'all') :
|
||||
|
||||
update_option(PK_THEME_SLUG.'_option_tree_'.ICL_LANGUAGE_CODE, $options);
|
||||
return $options;
|
||||
|
||||
endif;
|
||||
|
||||
if (function_exists('qtrans_getLanguage') && qtrans_getLanguage() != '') :
|
||||
|
||||
update_option(PK_THEME_SLUG.'_option_tree_'.qtrans_getLanguage(), $options);
|
||||
return $options;
|
||||
|
||||
endif;
|
||||
|
||||
update_option(PK_THEME_SLUG.'_option_tree', $options);
|
||||
return $options;
|
||||
|
||||
}
|
||||
|
||||
add_filter('pre_update_option_option_tree', 'pk_ot_update_options');
|
||||
|
||||
function pk_ot_get_options($options) {
|
||||
|
||||
if (defined('ICL_LANGUAGE_CODE') && ICL_LANGUAGE_CODE != 'all') :
|
||||
|
||||
$trans_options = get_option(PK_THEME_SLUG.'_option_tree_'.ICL_LANGUAGE_CODE);
|
||||
|
||||
if (!$trans_options || $trans_options == '') {
|
||||
|
||||
global $sitepress;
|
||||
$trans_options = get_option(PK_THEME_SLUG.'_option_tree_'.$sitepress -> get_default_language());
|
||||
|
||||
}
|
||||
|
||||
return $trans_options;
|
||||
|
||||
endif;
|
||||
|
||||
if (function_exists('qtrans_getLanguage') && qtrans_getLanguage() != '') :
|
||||
|
||||
$trans_options = get_option(PK_THEME_SLUG.'_option_tree_'.qtrans_getLanguage());
|
||||
|
||||
if (!$trans_options || $trans_options == '') {
|
||||
|
||||
$trans_options = get_option(PK_THEME_SLUG.'_option_tree_'.get_option('qtranslate_default_language'));
|
||||
|
||||
}
|
||||
|
||||
return $trans_options;
|
||||
|
||||
endif;
|
||||
|
||||
return get_option(PK_THEME_SLUG.'_option_tree');
|
||||
|
||||
}
|
||||
|
||||
add_filter('option_option_tree', 'pk_ot_get_options');
|
||||
|
||||
function pk_ot_update_layouts($options) {
|
||||
|
||||
if (defined('ICL_LANGUAGE_CODE') && ICL_LANGUAGE_CODE != 'all') :
|
||||
|
||||
update_option(PK_THEME_SLUG.'_option_tree_layouts_'.ICL_LANGUAGE_CODE, $options);
|
||||
return $options;
|
||||
|
||||
endif;
|
||||
|
||||
if (function_exists('qtrans_getLanguage') && qtrans_getLanguage() != '') :
|
||||
|
||||
update_option(PK_THEME_SLUG.'_option_tree_layouts_'.qtrans_getLanguage(), $options);
|
||||
return $options;
|
||||
|
||||
endif;
|
||||
|
||||
update_option(PK_THEME_SLUG.'_option_tree_layouts', $options);
|
||||
return $options;
|
||||
|
||||
}
|
||||
|
||||
add_filter('pre_update_option_option_tree_layouts', 'pk_ot_update_layouts');
|
||||
|
||||
function pk_ot_get_layouts($options) {
|
||||
|
||||
if (defined('ICL_LANGUAGE_CODE') && ICL_LANGUAGE_CODE != 'all') :
|
||||
|
||||
return get_option(PK_THEME_SLUG.'_option_tree_layouts_'.ICL_LANGUAGE_CODE);
|
||||
|
||||
endif;
|
||||
|
||||
if (function_exists('qtrans_getLanguage') && qtrans_getLanguage() != '') :
|
||||
|
||||
return get_option(PK_THEME_SLUG.'_option_tree_layouts_'.qtrans_getLanguage());
|
||||
|
||||
endif;
|
||||
|
||||
return get_option(PK_THEME_SLUG.'_option_tree_layouts');
|
||||
|
||||
}
|
||||
|
||||
add_filter('option_option_tree_layouts', 'pk_ot_get_layouts');
|
||||
|
||||
remove_filter('comment_text', 'make_clickable', 9);
|
||||
|
||||
if (!current_user_can('edit_posts')) add_filter('show_admin_bar', '__return_false');
|
||||
|
||||
?>
|
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
add_action('admin_init', 'pk_init_metaboxes');
|
||||
add_action('save_post', 'pk_save_metaboxes_values');
|
||||
|
||||
function pk_init_metaboxes() {
|
||||
|
||||
if (function_exists('add_meta_box')) {
|
||||
|
||||
add_meta_box('pagesformatdiv', __('Format', 'pk_translate'), 'pk_create_pages_format_metabox', 'page', 'side', 'default');
|
||||
add_meta_box('worksformatdiv', __('Format', 'pk_translate'), 'pk_create_works_format_metabox', 'portfolio', 'side', 'default');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_create_pages_format_metabox() {
|
||||
|
||||
global $post;
|
||||
|
||||
$post_meta = get_post_custom($post -> ID);
|
||||
$selected = (isset($post_meta['_page_format'][0])) ? $post_meta['_page_format'][0] : 'standard';
|
||||
|
||||
echo '
|
||||
<div id="page-formats-select">
|
||||
<input type="radio" name="_page_format" class="post-format" id="page-format-standard" value="standard"'.(($selected == 'standard') ? ' checked="checked" ' : ' ').'/> <label for="page-format-standard">'.__('Standard', 'pk_translate').'</label><br />
|
||||
<input type="radio" name="_page_format" class="post-format" id="page-format-image" value="image"'.(($selected == 'image') ? ' checked="checked" ' : ' ').'/> <label for="page-format-image">'.__('Image', 'pk_translate').'</label><br />
|
||||
<input type="radio" name="_page_format" class="post-format" id="page-format-video" value="video"'.(($selected == 'video') ? ' checked="checked" ' : ' ').'/> <label for="page-format-video">'.__('Video', 'pk_translate').'</label><br />
|
||||
<input type="radio" name="_page_format" class="post-format" id="page-format-audio" value="audio"'.(($selected == 'audio') ? ' checked="checked" ' : ' ').'/> <label for="page-format-audio">'.__('Audio', 'pk_translate').'</label><br />
|
||||
<input type="radio" name="_page_format" class="post-format" id="page-format-slider" value="slider"'.(($selected == 'slider') ? ' checked="checked" ' : ' ').'/> <label for="page-format-slider">'.__('Slider', 'pk_translate').'</label><br />
|
||||
<input type="radio" name="_page_format" class="post-format" id="page-format-gallery" value="gallery"'.(($selected == 'gallery') ? ' checked="checked" ' : ' ').'/> <label for="page-format-gallery">'.__('Lightbox gallery', 'pk_translate').'</label><br />
|
||||
</div>
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
function pk_create_works_format_metabox() {
|
||||
|
||||
global $post;
|
||||
|
||||
$post_meta = get_post_custom($post -> ID);
|
||||
$selected = (isset($post_meta['_work_format'][0])) ? $post_meta['_work_format'][0] : 'standard';
|
||||
|
||||
echo '
|
||||
<div id="work-formats-select">
|
||||
<input type="radio" name="_work_format" class="post-format" id="work-format-standard" value="standard"'.(($selected == 'standard') ? ' checked="checked" ' : ' ').'/> <label for="work-format-standard">'.__('Standard', 'pk_translate').'</label><br />
|
||||
<input type="radio" name="_work_format" class="post-format" id="work-format-image" value="image"'.(($selected == 'image') ? ' checked="checked" ' : ' ').'/> <label for="work-format-image">'.__('Image', 'pk_translate').'</label><br />
|
||||
<input type="radio" name="_work_format" class="post-format" id="work-format-video" value="video"'.(($selected == 'video') ? ' checked="checked" ' : ' ').'/> <label for="work-format-video">'.__('Video', 'pk_translate').'</label><br />
|
||||
<input type="radio" name="_work_format" class="post-format" id="work-format-audio" value="audio"'.(($selected == 'audio') ? ' checked="checked" ' : ' ').'/> <label for="work-format-audio">'.__('Audio', 'pk_translate').'</label><br />
|
||||
<input type="radio" name="_work_format" class="post-format" id="work-format-slider" value="slider"'.(($selected == 'slider') ? ' checked="checked" ' : ' ').'/> <label for="work-format-slider">'.__('Slider', 'pk_translate').'</label><br />
|
||||
<input type="radio" name="_work_format" class="post-format" id="work-format-gallery" value="gallery"'.(($selected == 'gallery') ? ' checked="checked" ' : ' ').'/> <label for="work-format-gallery">'.__('Lightbox gallery', 'pk_translate').'</label><br />
|
||||
</div>
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
function pk_save_metaboxes_values($post_id) {
|
||||
|
||||
if (isset($_POST['_page_format'])) {
|
||||
|
||||
update_post_meta($post_id, '_page_format', $_POST['_page_format']);
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['_work_format'])) {
|
||||
|
||||
update_post_meta($post_id, '_work_format', $_POST['_work_format']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
function pk_remove_bbp_stylesheets(){
|
||||
|
||||
wp_deregister_style('bbp-default-bbpress');
|
||||
wp_deregister_style('bbp-twentyten-bbpress');
|
||||
|
||||
}
|
||||
|
||||
add_action('wp_enqueue_scripts', 'pk_remove_bbp_stylesheets');
|
||||
|
||||
function pk_bbp_no_breadcrumb($param) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
add_filter ('bbp_no_breadcrumb', 'pk_bbp_no_breadcrumb');
|
||||
|
||||
?>
|
@ -0,0 +1,273 @@
|
||||
<?php
|
||||
|
||||
function pk_get_option($name, $default = false) {
|
||||
|
||||
global $option_tree;
|
||||
|
||||
$option = (isset($option_tree[$name])) ? $option_tree[$name] : $default;
|
||||
|
||||
if (isset($option) && $option != '') {
|
||||
|
||||
return (is_array($option)) ? $option : stripslashes($option);
|
||||
|
||||
} else {
|
||||
|
||||
return $default;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_custom_login_logo() {
|
||||
|
||||
echo '
|
||||
<style type="text/css">
|
||||
.login h1 a { width: 100%; height:'.pk_get_option('logo_height', '60').'px; background-size:'.pk_get_option('logo_width', '130').'px '.pk_get_option('logo_height', '60').'px; background-image:url('.pk_get_option('logo', PK_THEME_DIR.'/images/logo.png').') !important; }
|
||||
</style>';
|
||||
|
||||
}
|
||||
|
||||
add_action('login_head', 'pk_custom_login_logo');
|
||||
|
||||
function pk_title() {
|
||||
|
||||
$separator = stripslashes(pk_get_option('title_separator', '|'));
|
||||
|
||||
wp_title($separator, true, 'right');
|
||||
|
||||
if (!is_404()) {
|
||||
|
||||
if ((int)get_query_var('paged') > 1) {
|
||||
|
||||
echo __('Page', 'pk_translate').' '.get_query_var('paged').' '.$separator.' ';
|
||||
|
||||
}
|
||||
|
||||
if ((int)get_query_var('page') > 1) {
|
||||
|
||||
echo __('Page', 'pk_translate').' '.get_query_var('page').' '.$separator.' ';
|
||||
|
||||
}
|
||||
|
||||
global $cpage;
|
||||
|
||||
if ($cpage >= 1) {
|
||||
|
||||
echo __('Comments Page', 'pk_translate').' '.$cpage.' '.$separator.' ';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bloginfo('name');
|
||||
|
||||
}
|
||||
|
||||
function pk_set_up_menu_message() {
|
||||
|
||||
if (current_user_can('edit_posts')) :
|
||||
?>
|
||||
<nav><ul class="menu"><li><a class="menu-item" href="<?php echo get_home_url().'/wp-admin/nav-menus.php'; ?>"><?php _e('Set up the menu', 'pk_translate'); ?></a></li></ul></nav>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
}
|
||||
|
||||
function pk_set_up_footer_menu_message() {
|
||||
|
||||
if (current_user_can('edit_posts')) :
|
||||
?>
|
||||
<nav class="pk_footer_menu"><ul class="menu"><li><a class="menu-item" href="<?php echo get_home_url().'/wp-admin/nav-menus.php'; ?>"><?php _e('Set up the menu', 'pk_translate'); ?></a></li></ul></nav>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
}
|
||||
|
||||
function pk_pagination($pages = '', $paged = 1, $range = 2) {
|
||||
|
||||
$showitems = ($range * 2) + 1;
|
||||
|
||||
if ($pages == '') {
|
||||
|
||||
global $wp_query;
|
||||
|
||||
$pages = $wp_query -> max_num_pages;
|
||||
|
||||
if(!$pages) {
|
||||
|
||||
$pages = 1;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (1 != $pages) {
|
||||
|
||||
if ($paged > 1) {
|
||||
|
||||
previous_posts_link(__('«', 'pk_translate'));
|
||||
|
||||
} else {
|
||||
|
||||
echo '<a>'.__('«', 'pk_translate').'</a>';
|
||||
|
||||
}
|
||||
|
||||
$c = 1;
|
||||
|
||||
for ($i = 1; $i <= $pages; $i++) {
|
||||
|
||||
if (1 != $pages && (!($i >= $paged + $range + 1 || $i <= $paged - $range - 1) || $pages <= $showitems)) {
|
||||
|
||||
echo ($paged == $i) ? '<a class="pk_current_page">'.$i.'</a>' : '<a href="'.esc_url(get_pagenum_link($i)).'">'.$i.'</a>';
|
||||
|
||||
$c++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($paged < $pages) {
|
||||
|
||||
next_posts_link(__('»', 'pk_translate'));
|
||||
|
||||
} else {
|
||||
|
||||
echo '<a>'.__('»', 'pk_translate').'</a>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_sidebar() {
|
||||
|
||||
$force_sidebar = pk_get_option('force_sidebar', 'no forcing');
|
||||
if ($force_sidebar != 'no forcing') : return ($force_sidebar == 'show') ? true : false; endif;
|
||||
|
||||
if (is_404()) : return (pk_get_option('404_sidebar', 'show') == 'show') ? true : false; endif;
|
||||
|
||||
if (is_search()) : return (pk_get_option('search_sidebar', 'show') == 'show') ? true : false; endif;
|
||||
|
||||
if (is_singular(array('post', 'portfolio', 'product')) || is_page_template('page-blog.php') || is_page_template('page-portfolio.php')) :
|
||||
|
||||
global $post;
|
||||
|
||||
$single_sidebar = get_post_meta($post -> ID, '_sidebar', true);
|
||||
if (isset($single_sidebar) && $single_sidebar == 'hide') : return false; else : return true; endif;
|
||||
|
||||
endif;
|
||||
|
||||
if ((is_home() || is_archive()) && !is_tax() && !is_post_type_archive() && pk_get_option('blog_sidebar', 'show') == 'hide') return false;
|
||||
|
||||
if (pk_is_portfolio()) : return (pk_get_option('portfolio_sidebar', 'hide') == 'hide') ? false : true; endif;
|
||||
|
||||
if (function_exists('is_bbpress') && is_bbpress()) : return (pk_get_option('bbpress_forum_sidebar', 'hide') == 'hide') ? false : true; endif;
|
||||
|
||||
if ((function_exists('is_product_category') || function_exists('is_product_tag') || function_exists('is_shop')) && (is_product_category() || is_product_tag() || is_shop())) return (pk_get_option('shop_sidebar', 'show') == 'hide') ? false : true;
|
||||
|
||||
return (is_page_template('page-home-agency.php') || is_page_template('page-home-business.php') || is_page_template('page-home-freelance.php') || is_page_template('page-full-width.php') || is_page_template('page-faq.php') || (function_exists('is_cart') && is_cart())) ? false : true;
|
||||
|
||||
}
|
||||
|
||||
function pk_is_portfolio() {
|
||||
|
||||
return (is_post_type_archive('portfolio') || is_tax('taxonomy_portfolio')) ? true : false;
|
||||
|
||||
}
|
||||
|
||||
function pk_feed_lifetime($seconds) {
|
||||
|
||||
return 3600;
|
||||
|
||||
}
|
||||
|
||||
function pk_any_feed($feed = '', $total_items = 1) {
|
||||
|
||||
if ($feed == '') $feed = get_bloginfo('rss_url');
|
||||
|
||||
include_once(ABSPATH.WPINC.'/feed.php');
|
||||
|
||||
add_filter('wp_feed_cache_transient_lifetime', 'pk_feed_lifetime');
|
||||
$rss = fetch_feed(esc_url($feed));
|
||||
remove_filter('wp_feed_cache_transient_lifetime', 'pk_feed_lifetime');
|
||||
|
||||
if (!is_wp_error($rss)) :
|
||||
|
||||
$maxitems = $rss -> get_item_quantity($total_items);
|
||||
$rss_items = $rss -> get_items(0, $maxitems);
|
||||
$output = '<ul>';
|
||||
|
||||
foreach ($rss_items as $item) :
|
||||
|
||||
$output .= '<li>'.$item -> get_description().' <a href="'.$item -> get_permalink().'" title="'.__('Read more', 'pk_translate').'" class="pk_button_read_more" target="_blank">'.__('Read more', 'pk_translate').'</a></li>';
|
||||
|
||||
endforeach;
|
||||
|
||||
$output .= '</ul>';
|
||||
|
||||
return $output;
|
||||
|
||||
else :
|
||||
|
||||
return '';
|
||||
|
||||
endif;
|
||||
|
||||
}
|
||||
|
||||
function pk_blog_categories_filter() {
|
||||
|
||||
?>
|
||||
|
||||
<div class="pk_categories_filter">
|
||||
<ul>
|
||||
<li><a href="<?php echo (get_option('show_on_front') == 'page') ? get_permalink((function_exists('icl_object_id')) ? icl_object_id(get_option('page_for_posts'), 'page', true) : get_option('page_for_posts')) : ((function_exists('icl_get_home_url')) ? icl_get_home_url() : home_url());?>" title="<?php _e('All', 'pk_translate'); ?>"<?php if (is_home()) echo ' class="pk_current_category"'; ?>><?php _e('All', 'pk_translate'); ?></a></li>
|
||||
<?php
|
||||
$categories = get_categories(array('hierarchical' => false, 'taxonomy' => 'category'));
|
||||
|
||||
foreach ($categories as $category) :
|
||||
?>
|
||||
<li><a href="<?php echo get_term_link($category -> slug, 'category'); ?>" title="<?php echo $category -> cat_name; ?>"<?php if (get_query_var('cat') == $category -> term_id) echo ' class="pk_current_category"'; ?>><?php echo $category -> cat_name; ?></a></li>
|
||||
<?php
|
||||
endforeach;
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
add_action('pk_blog_categories', 'pk_blog_categories_filter');
|
||||
|
||||
function pk_portfolio_categories_filter() {
|
||||
|
||||
?>
|
||||
|
||||
<div class="pk_categories_filter">
|
||||
<ul>
|
||||
<?php
|
||||
if (pk_get_option('portfolio_page_id', '') != '') :
|
||||
?>
|
||||
<li><a href="<?php echo get_permalink((function_exists('icl_object_id')) ? icl_object_id(pk_get_option('portfolio_page_id', ''), 'page', true) : pk_get_option('portfolio_page_id', '')); ?>" title="<?php _e('All', 'pk_translate'); ?>"<?php if (!is_tax() && get_the_ID() == ((function_exists('icl_object_id')) ? icl_object_id(pk_get_option('portfolio_page_id', ''), 'page', true) : pk_get_option('portfolio_page_id', ''))) echo ' class="pk_current_category"'; ?>><?php _e('All', 'pk_translate'); ?></a></li>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
$categories = get_categories(array('hierarchical' => false, 'taxonomy' => 'taxonomy_portfolio'));
|
||||
|
||||
foreach ($categories as $category) :
|
||||
?>
|
||||
<li><a href="<?php echo get_term_link($category -> slug, 'taxonomy_portfolio'); ?>" title="<?php echo $category -> cat_name; ?>"<?php if (get_query_var('term') == $category -> slug) echo ' class="pk_current_category"'; ?>><?php echo $category -> cat_name; ?></a></li>
|
||||
<?php
|
||||
endforeach;
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
add_action('pk_portfolio_categories', 'pk_portfolio_categories_filter');
|
||||
|
||||
?>
|
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
add_filter('post_gallery', 'pk_post_gallery', 10, 2);
|
||||
|
||||
function pk_post_gallery($output, $attr) {
|
||||
|
||||
if (isset($attr['link']) && $attr['link'] == 'file') :
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery(".gallery a").attr('rel', 'wp_gallery').prettyPhoto(<?php echo PK_PRETTYPHOTO_PARAMS; ?>);
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
endif;
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
function pk_get_post_gallery_images($size = 'thumbnail') {
|
||||
|
||||
$post_type = get_post_type(get_the_ID());
|
||||
$post_format = '';
|
||||
|
||||
if ($post_type == 'post') $post_format = (!get_post_format(get_the_ID())) ? 'standard' : get_post_format(get_the_ID());
|
||||
if ($post_type == 'portfolio') $post_format = get_post_meta(get_the_ID(), '_work_format', true);
|
||||
if ($post_type == 'page') $post_format = get_post_meta(get_the_ID(), '_page_format', true);
|
||||
|
||||
$post_images = array();
|
||||
|
||||
if($images = get_posts(array(
|
||||
'post_parent' => get_the_ID(),
|
||||
'post_type' => 'attachment',
|
||||
'numberposts' => -1,
|
||||
'post_status' => 'null',
|
||||
'post_mime_type' => 'image',
|
||||
'orderby' => 'menu_order',
|
||||
'order' => 'ASC',
|
||||
'exclude' => (($post_format == 'slider') ? 'null' : get_post_thumbnail_id(get_the_ID()))
|
||||
))) {
|
||||
|
||||
$count = 0;
|
||||
|
||||
foreach($images as $image) {
|
||||
|
||||
$exclude_from_gallery = get_post_meta($image -> ID, '_exclude_from_gallery', true);
|
||||
|
||||
if ($exclude_from_gallery == 'yes') continue;
|
||||
|
||||
$img = wp_get_attachment_image($image -> ID, $size);
|
||||
$post_images[$count]['img'] = $img;
|
||||
$post_images[$count]['id'] = $image -> ID;
|
||||
$post_images[$count]['url'] = $image -> guid;
|
||||
$post_images[$count]['title'] = $image -> post_title;
|
||||
$post_images[$count]['description'] = $image -> post_content;
|
||||
|
||||
$count++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $post_images;
|
||||
|
||||
}
|
||||
|
||||
function pk_get_featured_image($size = 'full') {
|
||||
|
||||
$image = '';
|
||||
|
||||
if (has_post_thumbnail()) {
|
||||
|
||||
$image = wp_get_attachment_image_src(get_post_thumbnail_id(), $size);
|
||||
$image = $image[0];
|
||||
|
||||
}
|
||||
|
||||
return $image;
|
||||
|
||||
}
|
||||
|
||||
?>
|
1798
wp-content/themes/New folder/pk2012_sold/framework/pk_metaboxes.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
if (!is_admin()) define('ICL_DONT_LOAD_NAVIGATION_CSS', true);
|
||||
if (!is_admin()) define('ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS', true);
|
||||
|
||||
function pk_qtranslate_edit_taxonomies() {
|
||||
$args = array('public' => true, '_builtin' => false);
|
||||
|
||||
$output = 'object';
|
||||
$operator = 'and';
|
||||
$taxonomies = get_taxonomies($args, $output, $operator);
|
||||
|
||||
if ($taxonomies) {
|
||||
|
||||
foreach($taxonomies as $taxonomy) {
|
||||
|
||||
add_action($taxonomy -> name.'_add_form', 'qtrans_modifyTermFormFor');
|
||||
add_action($taxonomy -> name.'_edit_form', 'qtrans_modifyTermFormFor');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (function_exists('qtrans_modifyTermFormFor')) add_action('admin_init', 'pk_qtranslate_edit_taxonomies');
|
||||
|
||||
function pk_load_theme_translation() {
|
||||
|
||||
load_theme_textdomain('pk_translate', get_template_directory().'/translate');
|
||||
|
||||
}
|
||||
|
||||
add_action('after_setup_theme', 'pk_load_theme_translation');
|
||||
|
||||
function pk_lang_object_ids($ids_array, $type) {
|
||||
|
||||
if (function_exists('icl_object_id')) {
|
||||
|
||||
$res = array();
|
||||
|
||||
if (is_array($ids_array)) foreach ($ids_array as $id) {
|
||||
|
||||
$xlat = icl_object_id($id, $type, true);
|
||||
|
||||
if(!is_null($xlat)) $res[] = $xlat;
|
||||
|
||||
}
|
||||
|
||||
return $res;
|
||||
|
||||
} else {
|
||||
|
||||
return $ids_array;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
2129
wp-content/themes/New folder/pk2012_sold/framework/pk_options.php
Normal file
@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
require_once (PK_FRAMEWORK.'/includes/tgm-plugin-activation/class-tgm-plugin-activation.php');
|
||||
|
||||
add_action('tgmpa_register', 'pk_register_required_plugins');
|
||||
|
||||
function pk_register_required_plugins() {
|
||||
|
||||
$plugins = array(
|
||||
|
||||
array(
|
||||
'name' => 'Breadcrumb NavXT',
|
||||
'slug' => 'breadcrumb-navxt',
|
||||
'required' => false,
|
||||
'version' => '',
|
||||
'force_activation' => false,
|
||||
'force_deactivation' => false,
|
||||
'external_url' => 'http://wordpress.org/extend/plugins/breadcrumb-navxt/'
|
||||
),
|
||||
|
||||
array(
|
||||
'name' => 'Background Manager',
|
||||
'slug' => 'background-manager',
|
||||
'required' => false,
|
||||
'version' => '',
|
||||
'force_activation' => false,
|
||||
'force_deactivation' => false,
|
||||
'external_url' => 'http://wordpress.org/extend/plugins/background-manager/'
|
||||
),
|
||||
|
||||
array(
|
||||
'name' => 'Contact Form 7',
|
||||
'slug' => 'contact-form-7',
|
||||
'required' => false,
|
||||
'version' => '',
|
||||
'force_activation' => false,
|
||||
'force_deactivation' => false,
|
||||
'external_url' => 'http://wordpress.org/extend/plugins/contact-form-7/'
|
||||
),
|
||||
|
||||
array(
|
||||
'name' => 'qTranslate',
|
||||
'slug' => 'qtranslate',
|
||||
'required' => false,
|
||||
'version' => '',
|
||||
'force_activation' => false,
|
||||
'force_deactivation' => false,
|
||||
'external_url' => 'http://wordpress.org/extend/plugins/qtranslate/'
|
||||
),
|
||||
|
||||
array(
|
||||
'name' => 'WPML Multilingual CMS',
|
||||
'slug' => 'sitepress-multilingual-cms',
|
||||
'required' => false,
|
||||
'version' => '',
|
||||
'force_activation' => false,
|
||||
'force_deactivation' => false,
|
||||
'external_url' => 'http://www.wpml.org/'
|
||||
),
|
||||
|
||||
array(
|
||||
'name' => 'JigoShop',
|
||||
'slug' => 'jigoshop',
|
||||
'required' => false,
|
||||
'version' => '',
|
||||
'force_activation' => false,
|
||||
'force_deactivation' => false,
|
||||
'external_url' => 'http://wordpress.org/extend/plugins/jigoshop/'
|
||||
),
|
||||
|
||||
array(
|
||||
'name' => 'WooCommerce',
|
||||
'slug' => 'woocommerce',
|
||||
'required' => false,
|
||||
'version' => '',
|
||||
'force_activation' => false,
|
||||
'force_deactivation' => false,
|
||||
'external_url' => 'http://www.woothemes.com/woocommerce/',
|
||||
),
|
||||
|
||||
array(
|
||||
'name' => 'bbPress',
|
||||
'slug' => 'bbpress',
|
||||
'required' => false,
|
||||
'version' => '',
|
||||
'force_activation' => false,
|
||||
'force_deactivation' => false,
|
||||
'external_url' => 'http://wordpress.org/extend/plugins/bbpress/',
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
$config = array(
|
||||
'domain' => 'pk_translate',
|
||||
'default_path' => '',
|
||||
'parent_menu_slug' => 'themes.php',
|
||||
'parent_url_slug' => 'themes.php',
|
||||
'menu' => 'install-required-plugins',
|
||||
'has_notices' => true,
|
||||
'is_automatic' => false,
|
||||
'message' => '',
|
||||
'strings' => array(
|
||||
'page_title' => __('Install Required Plugins', 'pk_translate'),
|
||||
'menu_title' => __('Theme Plugins', 'pk_translate'),
|
||||
'installing' => __('Installing Plugin: %s', 'pk_translate'),
|
||||
'oops' => __('Something went wrong with the plugin API.', 'pk_translate'),
|
||||
'notice_can_install_required' => _n_noop('This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.'),
|
||||
'notice_can_install_recommended' => _n_noop('This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.'),
|
||||
'notice_cannot_install' => _n_noop('Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.'),
|
||||
'notice_can_activate_required' => _n_noop('The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.'),
|
||||
'notice_can_activate_recommended' => _n_noop('The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.'),
|
||||
'notice_cannot_activate' => _n_noop('Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.'),
|
||||
'notice_ask_to_update' => _n_noop('The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.'), // %1$s = plugin name(s)
|
||||
'notice_cannot_update' => _n_noop('Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.'),
|
||||
'install_link' => _n_noop('Begin installing plugin', 'Begin installing plugins'),
|
||||
'activate_link' => _n_noop('Activate installed plugin', 'Activate installed plugins'),
|
||||
'return' => __('Return to Required Plugins Installer', 'pk_translate'),
|
||||
'plugin_activated' => __('Plugin activated successfully.', 'pk_translate'),
|
||||
'complete' => __('All plugins installed and activated successfully. %s', 'pk_translate'),
|
||||
'nag_type' => 'updated'
|
||||
)
|
||||
);
|
||||
|
||||
tgmpa($plugins, $config);
|
||||
|
||||
}
|
@ -0,0 +1,182 @@
|
||||
<?php
|
||||
|
||||
function pk_register_portfolio() {
|
||||
|
||||
$labels = array(
|
||||
'name' => _x('Portfolio', 'post type general name', 'pk_translate'),
|
||||
'singular_name' => _x('Work', 'post type singular name', 'pk_translate'),
|
||||
'add_new' => _x('Add New Work', 'release', 'pk_translate'),
|
||||
'add_new_item' => __('Add New Work', 'pk_translate'),
|
||||
'edit_item' => __('Edit Work', 'pk_translate'),
|
||||
'new_item' => __('New Work', 'pk_translate'),
|
||||
'view_item' => __('View Work', 'pk_translate'),
|
||||
'search_items' => __('Search Works', 'pk_translate'),
|
||||
'not_found' => __('No works found', 'pk_translate'),
|
||||
'not_found_in_trash' => __('No works found in Trash', 'pk_translate')
|
||||
);
|
||||
|
||||
$args = array(
|
||||
'labels' => $labels,
|
||||
'public' => true,
|
||||
'menu_position' => 5,
|
||||
'capability_type' => 'post',
|
||||
'hierarchical' => false,
|
||||
'supports' => array('title', 'editor', 'excerpt', 'comments', 'revisions', 'thumbnail', 'custom-fields'),
|
||||
'query_var' => true,
|
||||
'rewrite' => array('slug' => 'portfolio-archive', 'with_front' => false),
|
||||
'show_in_nav_menus' => true,
|
||||
'has_archive' => true
|
||||
);
|
||||
|
||||
$taxonomy_labels = array(
|
||||
'name' => _x('Portfolio Categories', 'taxonomy general name', 'pk_translate'),
|
||||
'singular_name' => _x('Category', 'taxonomy singular name', 'pk_translate'),
|
||||
'search_items' => __('Search Category', 'pk_translate'),
|
||||
'popular_items' => __('Popular Categories', 'pk_translate'),
|
||||
'all_items' => __('All Categories', 'pk_translate'),
|
||||
'parent_item' => __('Parent Category', 'pk_translate'),
|
||||
'parent_item_colon' => __('Parent Category:', 'pk_translate'),
|
||||
'edit_item' => __('Edit Category', 'pk_translate'),
|
||||
'add_new_item' => __('Add New Category', 'pk_translate'),
|
||||
'new_item_name' => __('New Category Name', 'pk_translate')
|
||||
);
|
||||
|
||||
$taxonomy_args = array(
|
||||
'labels' => $taxonomy_labels,
|
||||
'public' => true,
|
||||
'show_in_nav_menus' => true,
|
||||
'show_ui' => true,
|
||||
'hierarchical' => true,
|
||||
'rewrite' => array('slug' => 'portfolio-category', 'with_front' => false),
|
||||
'query_var' => true
|
||||
);
|
||||
|
||||
register_post_type('portfolio', $args);
|
||||
|
||||
register_taxonomy('taxonomy_portfolio', 'portfolio', $taxonomy_args);
|
||||
|
||||
flush_rewrite_rules();
|
||||
|
||||
}
|
||||
|
||||
add_action('init', 'pk_register_portfolio');
|
||||
|
||||
function pk_portfolio_edit_columns($columns){
|
||||
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __('Title', 'pk_translate'),
|
||||
'portfolio_thumb' => __('Featured Image', 'pk_translate'),
|
||||
'author' => __('Author', 'pk_translate'),
|
||||
'taxonomy_portfolio' => __('Categories', 'pk_translate'),
|
||||
'comments' => $columns['comments'],
|
||||
'date' => $columns['date']
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
}
|
||||
|
||||
add_filter('manage_edit-portfolio_columns', 'pk_portfolio_edit_columns');
|
||||
|
||||
function pk_portfolio_custom_columns($column){
|
||||
|
||||
global $post;
|
||||
|
||||
switch ($column) {
|
||||
|
||||
case 'portfolio_thumb':
|
||||
|
||||
if (function_exists('the_post_thumbnail') && has_post_thumbnail()) {
|
||||
|
||||
the_post_thumbnail(array(80, 80));
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'taxonomy_portfolio':
|
||||
|
||||
echo get_the_term_list($post -> ID, 'taxonomy_portfolio', '', ', ', '');
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
add_action('manage_posts_custom_column', 'pk_portfolio_custom_columns');
|
||||
|
||||
function pk_save_portfolio_sort() {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$order = explode(',', $_POST['order']);
|
||||
|
||||
$counter = 0;
|
||||
|
||||
foreach ($order as $portfolio_id) {
|
||||
|
||||
$wpdb -> update($wpdb -> posts, array('menu_order' => $counter), array('ID' => $portfolio_id));
|
||||
$counter++;
|
||||
|
||||
}
|
||||
|
||||
die();
|
||||
|
||||
}
|
||||
|
||||
add_action('wp_ajax_portfolio_sort', 'pk_save_portfolio_sort');
|
||||
|
||||
function pk_add_sort_portfolio_page() {
|
||||
|
||||
add_submenu_page('edit.php?post_type=portfolio', __('Sort Works', 'pk_translate'), __('Sort Works', 'pk_translate'), 'edit_posts', basename(__FILE__), 'pk_create_sort_portfolio_page');
|
||||
|
||||
}
|
||||
|
||||
add_action('admin_menu', 'pk_add_sort_portfolio_page');
|
||||
|
||||
function pk_create_sort_portfolio_page() {
|
||||
|
||||
$portfolio = new WP_Query('post_type=portfolio&posts_per_page=-1&orderby=menu_order&order=ASC');
|
||||
|
||||
?>
|
||||
|
||||
<!-- pk sort portfolio page - start -->
|
||||
<div class="wrap">
|
||||
<div id="icon-options-general" class="icon32">
|
||||
<br />
|
||||
</div>
|
||||
<h2><?php _e('Sort Works', 'pk_translate'); ?> <a href="<?php echo admin_url('post-new.php').'?post_type=portfolio'; ?>" class="button add-new-h2"><?php _e('Add New', 'pk_translate'); ?></a></h2>
|
||||
<br />
|
||||
<div id="pk_admin_saving_sorting" class="updated">
|
||||
<p><strong><?php _e('Saving works order...', 'pk_translate'); ?></strong></p>
|
||||
</div>
|
||||
<div id="pk_admin_success_sorting" class="updated">
|
||||
<p><strong><?php _e('Works order saved!', 'pk_translate'); ?></strong></p>
|
||||
</div>
|
||||
<div id="pk_admin_error_sorting" class="updated">
|
||||
<p><strong><?php _e('Error saving works order, please try again.', 'pk_translate'); ?></strong></p>
|
||||
</div>
|
||||
<div>
|
||||
<ul id="pk_admin_sortable_list">
|
||||
<?php if ($portfolio -> have_posts()) : while ($portfolio -> have_posts()) : $portfolio -> the_post(); ?>
|
||||
<li id="<?php the_id(); ?>" class="pk_admin_sortable_default">
|
||||
<?php if (function_exists('the_post_thumbnail') && has_post_thumbnail()) { the_post_thumbnail(array(80, 80), array('class' => 'pk_admin_sort_thumb')); } else { echo '<span class="pk_admin_sort_no_img"></span>'; } ?>
|
||||
|
||||
<strong><a class="pk_admin_sort_titles" href="<?php echo admin_url('post.php').'?post='; the_id(); echo '&action=edit'; ?>"><?php the_title(); ?></a></strong>
|
||||
<p class="pk_admin_class_taxonomies"><?php the_taxonomies(); ?></p>
|
||||
</li>
|
||||
<?php endwhile; ?>
|
||||
</ul>
|
||||
<?php else :?>
|
||||
<p><?php _e('No works found', 'pk_translate'); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- pk sort portfolio page - end -->
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
125
wp-content/themes/New folder/pk2012_sold/framework/pk_setup.php
Normal file
@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
function pk_enqueue_theme_scripts() {
|
||||
|
||||
if (is_admin()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
wp_enqueue_script('jquery');
|
||||
|
||||
if (is_singular() && get_option('thread_comments')) wp_enqueue_script('comment-reply', false, array(), false, true);
|
||||
|
||||
if (pk_get_option('optimize', 'false') == 'false') :
|
||||
|
||||
wp_deregister_script('jquery-easing');
|
||||
wp_register_script('jquery-easing', PK_THEME_DIR.'/js/jquery.easing.js', array('jquery'), false, true);
|
||||
wp_enqueue_script('jquery-easing');
|
||||
|
||||
wp_deregister_script('pk-jplayer');
|
||||
wp_register_script('pk-jplayer', PK_THEME_DIR.'/js/jquery.jplayer.min.js', array('jquery'), false, true);
|
||||
wp_enqueue_script('pk-jplayer');
|
||||
|
||||
wp_deregister_script('pretty-photo');
|
||||
wp_register_script('pretty-photo', PK_THEME_DIR.'/prettyPhoto/js/jquery.prettyPhoto.js', array('jquery'), false, true);
|
||||
wp_enqueue_script('pretty-photo');
|
||||
|
||||
wp_deregister_script('pk-slider');
|
||||
wp_register_script('pk-slider', PK_THEME_DIR.'/js/pk_slider.js', array('jquery'), false, true);
|
||||
wp_enqueue_script('pk-slider');
|
||||
|
||||
wp_deregister_script('pk-content-slider');
|
||||
wp_register_script('pk-content-slider', PK_THEME_DIR.'/js/pk_content_slider.js', array('jquery'), false, true);
|
||||
wp_enqueue_script('pk-content-slider');
|
||||
|
||||
wp_deregister_script('pk');
|
||||
wp_register_script('pk', PK_THEME_DIR.'/js/pk.js', array('jquery'), false, true);
|
||||
wp_enqueue_script('pk');
|
||||
|
||||
else :
|
||||
|
||||
wp_register_script('pk', PK_THEME_DIR.'/js/pk_allinone_js.php', array('jquery'), false, true);
|
||||
wp_enqueue_script('pk');
|
||||
|
||||
endif;
|
||||
|
||||
}
|
||||
|
||||
add_action('wp_enqueue_scripts', 'pk_enqueue_theme_scripts');
|
||||
|
||||
function pk_enqueue_theme_styles() {
|
||||
|
||||
if (is_admin()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (pk_get_option('optimize', 'false') == 'false' || (function_exists('is_jigoshop') && pk_get_option('selected_skin', 'light') == 'custom')) :
|
||||
|
||||
wp_deregister_style('pk_reset');
|
||||
wp_register_style('pk_reset', PK_THEME_DIR.'/css/pk_reset.css');
|
||||
wp_enqueue_style('pk_reset');
|
||||
|
||||
wp_deregister_style('pk_jigoshop');
|
||||
wp_register_style('pk_jigoshop', PK_THEME_DIR.'/css/pk_jigoshop.css');
|
||||
if (function_exists('is_jigoshop')) wp_enqueue_style('pk_jigoshop');
|
||||
|
||||
wp_deregister_style('pk_jigoshop_widgets');
|
||||
wp_register_style('pk_jigoshop_widgets', PK_THEME_DIR.'/css/pk_jigoshop_widgets.css');
|
||||
if (function_exists('is_jigoshop')) wp_enqueue_style('pk_jigoshop_widgets');
|
||||
|
||||
wp_deregister_style('pk_woocommerce');
|
||||
wp_register_style('pk_woocommerce', PK_THEME_DIR.'/css/pk_woocommerce.css');
|
||||
if (function_exists('is_woocommerce')) wp_enqueue_style('pk_woocommerce');
|
||||
|
||||
wp_deregister_style('pk_woocommerce_widgets');
|
||||
wp_register_style('pk_woocommerce_widgets', PK_THEME_DIR.'/css/pk_woocommerce_widgets.css');
|
||||
if (function_exists('is_woocommerce')) wp_enqueue_style('pk_woocommerce_widgets');
|
||||
|
||||
wp_deregister_style('pk_bbpress');
|
||||
wp_register_style('pk_bbpress', PK_THEME_DIR.'/css/pk_bbpress.css');
|
||||
if (function_exists('is_bbpress')) wp_enqueue_style('pk_bbpress');
|
||||
|
||||
wp_deregister_style('pk_bbpress_widgets');
|
||||
wp_register_style('pk_bbpress_widgets', PK_THEME_DIR.'/css/pk_bbpress_widgets.css');
|
||||
if (function_exists('is_bbpress')) wp_enqueue_style('pk_bbpress_widgets');
|
||||
|
||||
wp_deregister_style('pk_shortcodes');
|
||||
wp_register_style('pk_shortcodes', PK_THEME_DIR.'/css/pk_shortcodes.css');
|
||||
wp_enqueue_style('pk_shortcodes');
|
||||
|
||||
wp_deregister_style('pk_widgets');
|
||||
wp_register_style('pk_widgets', PK_THEME_DIR.'/css/pk_widgets.css');
|
||||
wp_enqueue_style('pk_widgets');
|
||||
|
||||
wp_deregister_style('pk_style');
|
||||
wp_register_style('pk_style', PK_THEME_DIR.'/css/pk_style.css');
|
||||
wp_enqueue_style('pk_style');
|
||||
|
||||
wp_deregister_style('pk_skin');
|
||||
wp_register_style('pk_skin', PK_THEME_DIR.'/css/pk_skin_'.pk_get_option('selected_skin', 'light').((pk_get_option('selected_skin', 'light') == 'custom') ? '.php?path='.urlencode(ABSPATH."wp-load.php") : '.css'));
|
||||
wp_enqueue_style('pk_skin');
|
||||
|
||||
wp_deregister_style('pretty-photo');
|
||||
wp_register_style('pretty-photo', PK_THEME_DIR.'/prettyPhoto/css/prettyPhoto.css');
|
||||
wp_enqueue_style('pretty-photo');
|
||||
|
||||
wp_deregister_style('pk_main_style');
|
||||
wp_register_style('pk_main_style', get_stylesheet_uri());
|
||||
wp_enqueue_style('pk_main_style');
|
||||
|
||||
else :
|
||||
|
||||
wp_register_style('pk', PK_THEME_DIR.'/css/pk_allinone_css.php?skin='.pk_get_option('selected_skin', 'light').'&path='.urlencode(ABSPATH."wp-load.php").'&ecommerce='.((function_exists('is_jigoshop')) ? 'jigoshop' : ((function_exists('is_woocommerce')) ? 'woocommerce' : '')).'&bbpress='.((function_exists('is_bbpress')) ? 'yes' : 'no'));
|
||||
wp_enqueue_style('pk');
|
||||
|
||||
endif;
|
||||
|
||||
}
|
||||
|
||||
add_action('wp_enqueue_scripts', 'pk_enqueue_theme_styles');
|
||||
|
||||
?>
|
@ -0,0 +1,356 @@
|
||||
<?php
|
||||
|
||||
function pk_register_sidebars() {
|
||||
|
||||
$custom_sidebars_for = pk_get_option('custom_sidebars_for', array());
|
||||
|
||||
if (is_array($custom_sidebars_for) && count($custom_sidebars_for) > 0) :
|
||||
|
||||
foreach ($custom_sidebars_for as $key => $id) :
|
||||
|
||||
$title = get_the_title($id);
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - ', 'pk_translate').$title,
|
||||
'id' => 'custom_sidebar_'.$id,
|
||||
'description' => __('Applied to ', 'pk_translate').$title,
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
$post_template = get_post_meta($id, '_wp_page_template', true);
|
||||
|
||||
if (in_array(get_post_type($id), array('page', 'post', 'portfolio', 'product')) && !in_array($post_template, array('page-blog.php', 'page-portfolio.php', 'page-faq.php', 'page-home-agency.php', 'page-home-business.php', 'page-home-freelance.php', 'page-home-standard.php', 'page-home-jigoshop.php', 'page-home-woocommerce.php'))) register_sidebar(array(
|
||||
'name' => __('After Content - ', 'pk_translate').$title,
|
||||
'id' => 'custom_sidebar_after_content_'.$id,
|
||||
'description' => __('Applied to ', 'pk_translate').$title,
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
endforeach;
|
||||
|
||||
endif;
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - All', 'pk_translate'),
|
||||
'id' => 'sidebar_all',
|
||||
'description' => __('Always applied.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - Front Page', 'pk_translate'),
|
||||
'id' => 'sidebar_front_page',
|
||||
'description' => __('Applied to the front page.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - JigoShop', 'pk_translate'),
|
||||
'id' => 'sidebar_jigoshop',
|
||||
'description' => __('Applied to the JigoShop pages.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - WooCommerce', 'pk_translate'),
|
||||
'id' => 'sidebar_woocommerce',
|
||||
'description' => __('Applied to the WooCommerce pages.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - BBPress Forum', 'pk_translate'),
|
||||
'id' => 'sidebar_bbpress_forum',
|
||||
'description' => __('Applied to the BBPress forum pages.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - Pages', 'pk_translate'),
|
||||
'id' => 'sidebar_pages',
|
||||
'description' => __('Applied to every page.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('After Page Content', 'pk_translate'),
|
||||
'id' => 'sidebar_after_page_content',
|
||||
'description' => __('Applied after every page content.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - Blog', 'pk_translate'),
|
||||
'id' => 'sidebar_blog',
|
||||
'description' => __('Applied to every blog page.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('After Blog Post Content', 'pk_translate'),
|
||||
'id' => 'sidebar_after_post_content',
|
||||
'description' => __('Applied after every blog post content.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - Portfolio', 'pk_translate'),
|
||||
'id' => 'sidebar_portfolio',
|
||||
'description' => __('Applied to every portfolio grid page.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget'=> '</div>',
|
||||
'before_title'=> '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('After Work Content', 'pk_translate'),
|
||||
'id' => 'sidebar_after_work_content',
|
||||
'description' => __('Applied after every work content.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - Search', 'pk_translate'),
|
||||
'id' => 'sidebar_search',
|
||||
'description' => __('Applied to the search results pages.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - 404', 'pk_translate'),
|
||||
'id' => 'sidebar_404',
|
||||
'description' => __('Applied to the "Error 404" page.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - Home Agency - Slider', 'pk_translate'),
|
||||
'id' => 'sidebar_home_page_agency_slider',
|
||||
'description' => __('Applied to the "Home Page Agency" page.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - Home Agency - Left', 'pk_translate'),
|
||||
'id' => 'sidebar_home_page_agency_left',
|
||||
'description' => __('Applied to the "Home Page Agency" page.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - Home Agency - Middle', 'pk_translate'),
|
||||
'id' => 'sidebar_home_page_agency_middle',
|
||||
'description' => __('Applied to the "Home Page Agency" page.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - Home Agency - Right', 'pk_translate'),
|
||||
'id' => 'sidebar_home_page_agency_right',
|
||||
'description' => __('Applied to the "Home Page Agency" page.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - Home Business - Left', 'pk_translate'),
|
||||
'id' => 'sidebar_home_page_business_left',
|
||||
'description' => __('Applied to the "Home Page Business" page.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - Home Business - Middle', 'pk_translate'),
|
||||
'id' => 'sidebar_home_page_business_middle',
|
||||
'description' => __('Applied to the "Home Page Business" page.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - Home Business - Right', 'pk_translate'),
|
||||
'id' => 'sidebar_home_page_business_right',
|
||||
'description' => __('Applied to the "Home Page Business" page.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - Home Freelance - Left', 'pk_translate'),
|
||||
'id' => 'sidebar_home_page_freelance_left',
|
||||
'description' => __('Applied to the "Home Page Freelance" page.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - Home Freelance - Middle', 'pk_translate'),
|
||||
'id' => 'sidebar_home_page_freelance_middle',
|
||||
'description' => __('Applied to the "Home Page Freelance" page.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - Home Freelance - Right', 'pk_translate'),
|
||||
'id' => 'sidebar_home_page_freelance_right',
|
||||
'description' => __('Applied to the "Home Page Freelance" page.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - Home Standard - Left', 'pk_translate'),
|
||||
'id' => 'sidebar_home_page_standard_left',
|
||||
'description' => __('Applied to the "Home Page Standard" page.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - Home Standard - Right', 'pk_translate'),
|
||||
'id' => 'sidebar_home_page_standard_right',
|
||||
'description' => __('Applied to the "Home Page Standard" page.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - Home JigoShop - Left', 'pk_translate'),
|
||||
'id' => 'sidebar_home_page_jigoshop_left',
|
||||
'description' => __('Applied to the "Home Page JigoShop" page.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - Home JigoShop - Right', 'pk_translate'),
|
||||
'id' => 'sidebar_home_page_jigoshop_right',
|
||||
'description' => __('Applied to the "Home Page JigoShop" page.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - Home WooCommerce - Left', 'pk_translate'),
|
||||
'id' => 'sidebar_home_page_woocommerce_left',
|
||||
'description' => __('Applied to the "Home Page WooCommerce" page.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Sidebar - Home WooCommerce - Right', 'pk_translate'),
|
||||
'id' => 'sidebar_home_page_woocommerce_right',
|
||||
'description' => __('Applied to the "Home Page WooCommerce" page.', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Footer Column 1', 'pk_translate'),
|
||||
'id' => 'footer_column_1',
|
||||
'description' => __('The first column in the footer widgets area (Set the number of columns in the footer options panel.)', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Footer Column 2', 'pk_translate'),
|
||||
'id' => 'footer_column_2',
|
||||
'description' => __('The second column in the footer widgets area (Set the number of columns in the footer options panel.)', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Footer Column 3', 'pk_translate'),
|
||||
'id' => 'footer_column_3',
|
||||
'description' => __('The third column in the footer widgets area (Set the number of columns in the footer options panel.)', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Footer Column 4', 'pk_translate'),
|
||||
'id' => 'footer_column_4',
|
||||
'description' => __('The fourth column in the footer widgets area (Set the number of columns in the footer options panel.)', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Footer Column 5', 'pk_translate'),
|
||||
'id' => 'footer_column_5',
|
||||
'description' => __('The fifth column in the footer widgets area (Set the number of columns in the footer options panel.)', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
register_sidebar(array(
|
||||
'name' => __('Footer Column 6', 'pk_translate'),
|
||||
'id' => 'footer_column_6',
|
||||
'description' => __('The sixth column in the footer widgets area (Set the number of columns in the footer options panel.)', 'pk_translate'),
|
||||
'before_widget' => '<div id="%1$s" class="pk_widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h5 class="pk_heading_uppercase">',
|
||||
'after_title' => '</h5>'));
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', 'pk_register_sidebars');
|
||||
|
||||
?>
|
106
wp-content/themes/New folder/pk2012_sold/framework/pk_theme.php
Normal file
@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
if (!class_exists('pk_theme')) {
|
||||
|
||||
class pk_theme {
|
||||
|
||||
function pk_theme() {
|
||||
|
||||
global $content_width;
|
||||
|
||||
if (!isset($content_width)) $content_width = 580;
|
||||
|
||||
require_once(PK_FRAMEWORK.'/widgets/pk_widgets.php');
|
||||
require_once(PK_FRAMEWORK.'/pk_ecommerce.php');
|
||||
require_once(PK_FRAMEWORK.'/pk_faq.php');
|
||||
require_once(PK_FRAMEWORK.'/pk_filters.php');
|
||||
require_once(PK_FRAMEWORK.'/pk_formats.php');
|
||||
require_once(PK_FRAMEWORK.'/pk_forums.php');
|
||||
require_once(PK_FRAMEWORK.'/pk_functions.php');
|
||||
require_once(PK_FRAMEWORK.'/pk_gallery_extended.php');
|
||||
require_once(PK_FRAMEWORK.'/pk_images.php');
|
||||
require_once(PK_FRAMEWORK.'/pk_multi_language.php');
|
||||
require_once(PK_FRAMEWORK.'/pk_portfolio.php');
|
||||
require_once(PK_FRAMEWORK.'/pk_setup.php');
|
||||
require_once(PK_FRAMEWORK.'/pk_sidebars.php');
|
||||
|
||||
if (is_admin()) {
|
||||
|
||||
require_once(PK_FRAMEWORK.'/pk_admin.php');
|
||||
|
||||
}
|
||||
|
||||
add_action('after_setup_theme', array(&$this, 'pk_add_theme_support'));
|
||||
|
||||
}
|
||||
|
||||
function pk_add_theme_support() {
|
||||
|
||||
if (function_exists('add_theme_support')) {
|
||||
|
||||
add_theme_support('post-formats', array(
|
||||
'aside',
|
||||
'chat',
|
||||
'gallery',
|
||||
'image',
|
||||
'link',
|
||||
'quote',
|
||||
'status',
|
||||
'video',
|
||||
'audio'
|
||||
));
|
||||
|
||||
add_theme_support('custom-background');
|
||||
|
||||
add_theme_support('custom-header');
|
||||
|
||||
add_theme_support('automatic-feed-links');
|
||||
|
||||
add_theme_support('post-thumbnails', array(
|
||||
'post',
|
||||
'page',
|
||||
'portfolio',
|
||||
'product'
|
||||
));
|
||||
|
||||
add_theme_support('menus');
|
||||
|
||||
add_editor_style();
|
||||
|
||||
}
|
||||
|
||||
if (function_exists('add_image_size')) {
|
||||
|
||||
add_image_size('thumb', 50, 50, true);
|
||||
add_image_size('thumb-latest-posts', 80, 80, true);
|
||||
add_image_size('thumb-latest-works', 180, 135, true);
|
||||
add_image_size('big', 580, 0);
|
||||
add_image_size('full-width', 940, 0);
|
||||
add_image_size('grid-normal', 460, 345, true);
|
||||
add_image_size('grid-special', 460, 0);
|
||||
|
||||
}
|
||||
|
||||
if (function_exists('register_nav_menu')) {
|
||||
|
||||
register_nav_menu('pk_main_menu_li', __('Main Menu (For logged in users)', 'pk_translate'));
|
||||
register_nav_menu('pk_footer_menu_li', __('Footer Menu (For logged in users)', 'pk_translate'));
|
||||
|
||||
register_nav_menu('pk_main_menu_lo', __('Main Menu (For logged out users)', 'pk_translate'));
|
||||
register_nav_menu('pk_footer_menu_lo', __('Footer Menu (For logged out users)', 'pk_translate'));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (class_exists('pk_theme') && !isset($theme_instance)) {
|
||||
|
||||
$theme_instance = new pk_theme();
|
||||
|
||||
}
|
||||
|
||||
?>
|
After Width: | Height: | Size: 243 B |
@ -0,0 +1,146 @@
|
||||
td.pk_admin_td {
|
||||
padding-top:10px;
|
||||
border-style:none;
|
||||
}
|
||||
|
||||
th.pk_admin_th {
|
||||
width:160px;
|
||||
border-style:none;
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
th.pk_admin_th h4 {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
input.pk_admin_button {
|
||||
width:70px;
|
||||
margin-left:6px;
|
||||
}
|
||||
|
||||
input.pk_admin_generate_shortcode_button {
|
||||
margin-left:6px;
|
||||
}
|
||||
|
||||
input.pk_admin_input_text_field {
|
||||
width:200px;
|
||||
padding-top:1px;
|
||||
}
|
||||
|
||||
textarea.pk_admin_input_text_area {
|
||||
width:80%;
|
||||
height:auto;
|
||||
}
|
||||
|
||||
select.pk_admin_input_select {
|
||||
width:200px;
|
||||
padding-top:1px;
|
||||
}
|
||||
|
||||
select.pk_admin_input_select_multiple {
|
||||
width:200px;
|
||||
height:auto;
|
||||
min-height:200px;
|
||||
padding-top:1px;
|
||||
margin-left:6px;
|
||||
margin-bottom:6px;
|
||||
}
|
||||
|
||||
select.pk_admin_input_select_box {
|
||||
width:200px;
|
||||
padding-top:1px;
|
||||
}
|
||||
|
||||
input.pk_admin_input_color {
|
||||
width:200px;
|
||||
padding-top:1px;
|
||||
}
|
||||
|
||||
input.pk_admin_input_slider {
|
||||
width:90px;
|
||||
padding-top:1px;
|
||||
margin-left:10px;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
input.pk_admin_radio_checkbox {
|
||||
margin-left:2px;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
p.pk_admin_helper {
|
||||
clear:left;
|
||||
color:#666666;
|
||||
}
|
||||
|
||||
strong.pk_admin_helper_strong {
|
||||
margin-left:2px;
|
||||
color:#ff0000;
|
||||
}
|
||||
|
||||
div.pk_admin_shortcode_manager_buttons_div {
|
||||
margin-top:8px;
|
||||
text-align:right;
|
||||
}
|
||||
|
||||
div.pk_admin_slider_div .slider {
|
||||
background-color:#eeeeee;
|
||||
width:200px;
|
||||
height:18px;
|
||||
position:relative;
|
||||
cursor:pointer;
|
||||
float:left;
|
||||
clear:right;
|
||||
border:1px solid #cccccc;
|
||||
margin-top:1px;
|
||||
border-radius:9px;
|
||||
-moz-border-radius:9px;
|
||||
-webkit-border-radius:9px;
|
||||
}
|
||||
|
||||
div.pk_admin_slider_div .handle {
|
||||
background-color:#ffffff;
|
||||
background-image:url('images/button_gradient.png');
|
||||
background-repeat:repeat-x;
|
||||
width:18px;
|
||||
height:18px;
|
||||
position:absolute;
|
||||
cursor:pointer;
|
||||
display:block;
|
||||
border-radius:9px;
|
||||
-moz-border-radius:9px;
|
||||
-webkit-border-radius:9px;
|
||||
}
|
||||
|
||||
div.pk_admin_multiple_checkbox_div {
|
||||
width:190px;
|
||||
float:left;
|
||||
margin-right:10px;
|
||||
margin-bottom:10px;
|
||||
}
|
||||
|
||||
div.pk_admin_multiple_checkbox_div_wrapper {
|
||||
width:400px;
|
||||
margin-left:6px;
|
||||
}
|
||||
|
||||
label.pk_admin_multiple_checkbox_label {
|
||||
margin-left:6px;
|
||||
cursor:default;
|
||||
}
|
||||
|
||||
label.pk_admin_radio_label {
|
||||
cursor:default;
|
||||
}
|
||||
|
||||
div.pk_admin_padding_top_div {
|
||||
padding-top:6px;
|
||||
}
|
||||
|
||||
div.pk_admin_padding_bottom_div {
|
||||
padding-bottom:6px;
|
||||
}
|
||||
|
||||
div.pk_admin_sc_div {
|
||||
display:none;
|
||||
}
|
After Width: | Height: | Size: 66 B |
After Width: | Height: | Size: 83 B |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 2.8 KiB |
@ -0,0 +1,840 @@
|
||||
/**
|
||||
* jscolor, JavaScript Color Picker
|
||||
*
|
||||
* @version 1.3.1
|
||||
* @license GNU Lesser General Public License, http://www.gnu.org/copyleft/lesser.html
|
||||
* @author Jan Odvarko, http://odvarko.cz
|
||||
* @created 2008-06-15
|
||||
* @updated 2010-01-23
|
||||
* @link http://jscolor.com
|
||||
*/
|
||||
|
||||
|
||||
var jscolor = {
|
||||
|
||||
|
||||
dir : '', // location of jscolor directory (leave empty to autodetect)
|
||||
bindClass : 'color', // class name
|
||||
binding : true, // automatic binding via <input class="...">
|
||||
preloading : true, // use image preloading?
|
||||
|
||||
|
||||
install : function() {
|
||||
jscolor.addEvent(window, 'load', jscolor.init);
|
||||
},
|
||||
|
||||
|
||||
init : function() {
|
||||
if(jscolor.binding) {
|
||||
jscolor.bind();
|
||||
}
|
||||
if(jscolor.preloading) {
|
||||
jscolor.preload();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
getDir : function() {
|
||||
if(!jscolor.dir) {
|
||||
var detected = jscolor.detectDir();
|
||||
jscolor.dir = detected!==false ? detected : 'jscolor/';
|
||||
}
|
||||
return jscolor.dir;
|
||||
},
|
||||
|
||||
|
||||
detectDir : function() {
|
||||
var base = location.href;
|
||||
|
||||
var e = document.getElementsByTagName('base');
|
||||
for(var i=0; i<e.length; i+=1) {
|
||||
if(e[i].href) { base = e[i].href; }
|
||||
}
|
||||
|
||||
var e = document.getElementsByTagName('script');
|
||||
for(var i=0; i<e.length; i+=1) {
|
||||
if(e[i].src && /(^|\/)jscolor\.js([?#].*)?$/i.test(e[i].src)) {
|
||||
var src = new jscolor.URI(e[i].src);
|
||||
var srcAbs = src.toAbsolute(base);
|
||||
srcAbs.path = srcAbs.path.replace(/[^\/]+$/, ''); // remove filename
|
||||
srcAbs.query = null;
|
||||
srcAbs.fragment = null;
|
||||
return srcAbs.toString();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
bind : function() {
|
||||
var matchClass = new RegExp('(^|\\s)('+jscolor.bindClass+')\\s*(\\{[^}]*\\})?', 'i');
|
||||
var e = document.getElementsByTagName('input');
|
||||
for(var i=0; i<e.length; i+=1) {
|
||||
var m;
|
||||
if(!e[i].color && e[i].className && (m = e[i].className.match(matchClass))) {
|
||||
var prop = {};
|
||||
if(m[3]) {
|
||||
try {
|
||||
eval('prop='+m[3]);
|
||||
} catch(eInvalidProp) {}
|
||||
}
|
||||
e[i].color = new jscolor.color(e[i], prop);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
preload : function() {
|
||||
for(var fn in jscolor.imgRequire) {
|
||||
if(jscolor.imgRequire.hasOwnProperty(fn)) {
|
||||
jscolor.loadImage(fn);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
images : {
|
||||
pad : [ 181, 101 ],
|
||||
sld : [ 16, 101 ],
|
||||
cross : [ 15, 15 ],
|
||||
arrow : [ 7, 11 ]
|
||||
},
|
||||
|
||||
|
||||
imgRequire : {},
|
||||
imgLoaded : {},
|
||||
|
||||
|
||||
requireImage : function(filename) {
|
||||
jscolor.imgRequire[filename] = true;
|
||||
},
|
||||
|
||||
|
||||
loadImage : function(filename) {
|
||||
if(!jscolor.imgLoaded[filename]) {
|
||||
jscolor.imgLoaded[filename] = new Image();
|
||||
jscolor.imgLoaded[filename].src = jscolor.getDir()+filename;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
fetchElement : function(mixed) {
|
||||
return typeof mixed === 'string' ? document.getElementById(mixed) : mixed;
|
||||
},
|
||||
|
||||
|
||||
addEvent : function(el, evnt, func) {
|
||||
if(el.addEventListener) {
|
||||
el.addEventListener(evnt, func, false);
|
||||
} else if(el.attachEvent) {
|
||||
el.attachEvent('on'+evnt, func);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
fireEvent : function(el, evnt) {
|
||||
if(!el) {
|
||||
return;
|
||||
}
|
||||
if(document.createEventObject) {
|
||||
var ev = document.createEventObject();
|
||||
el.fireEvent('on'+evnt, ev);
|
||||
} else if(document.createEvent) {
|
||||
var ev = document.createEvent('HTMLEvents');
|
||||
ev.initEvent(evnt, true, true);
|
||||
el.dispatchEvent(ev);
|
||||
} else if(el['on'+evnt]) { // alternatively use the traditional event model (IE5)
|
||||
el['on'+evnt]();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
getElementPos : function(e) {
|
||||
var e1=e, e2=e;
|
||||
var x=0, y=0;
|
||||
if(e1.offsetParent) {
|
||||
do {
|
||||
x += e1.offsetLeft;
|
||||
y += e1.offsetTop;
|
||||
} while(e1 = e1.offsetParent);
|
||||
}
|
||||
while((e2 = e2.parentNode) && e2.nodeName.toUpperCase() !== 'BODY') {
|
||||
x -= e2.scrollLeft;
|
||||
y -= e2.scrollTop;
|
||||
}
|
||||
return [x, y];
|
||||
},
|
||||
|
||||
|
||||
getElementSize : function(e) {
|
||||
return [e.offsetWidth, e.offsetHeight];
|
||||
},
|
||||
|
||||
|
||||
getMousePos : function(e) {
|
||||
if(!e) { e = window.event; }
|
||||
if(typeof e.pageX === 'number') {
|
||||
return [e.pageX, e.pageY];
|
||||
} else if(typeof e.clientX === 'number') {
|
||||
return [
|
||||
e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft,
|
||||
e.clientY + document.body.scrollTop + document.documentElement.scrollTop
|
||||
];
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
getViewPos : function() {
|
||||
if(typeof window.pageYOffset === 'number') {
|
||||
return [window.pageXOffset, window.pageYOffset];
|
||||
} else if(document.body && (document.body.scrollLeft || document.body.scrollTop)) {
|
||||
return [document.body.scrollLeft, document.body.scrollTop];
|
||||
} else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
|
||||
return [document.documentElement.scrollLeft, document.documentElement.scrollTop];
|
||||
} else {
|
||||
return [0, 0];
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
getViewSize : function() {
|
||||
if(typeof window.innerWidth === 'number') {
|
||||
return [window.innerWidth, window.innerHeight];
|
||||
} else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
|
||||
return [document.body.clientWidth, document.body.clientHeight];
|
||||
} else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
|
||||
return [document.documentElement.clientWidth, document.documentElement.clientHeight];
|
||||
} else {
|
||||
return [0, 0];
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
URI : function(uri) { // See RFC3986
|
||||
|
||||
this.scheme = null;
|
||||
this.authority = null;
|
||||
this.path = '';
|
||||
this.query = null;
|
||||
this.fragment = null;
|
||||
|
||||
this.parse = function(uri) {
|
||||
var m = uri.match(/^(([A-Za-z][0-9A-Za-z+.-]*)(:))?((\/\/)([^\/?#]*))?([^?#]*)((\?)([^#]*))?((#)(.*))?/);
|
||||
this.scheme = m[3] ? m[2] : null;
|
||||
this.authority = m[5] ? m[6] : null;
|
||||
this.path = m[7];
|
||||
this.query = m[9] ? m[10] : null;
|
||||
this.fragment = m[12] ? m[13] : null;
|
||||
return this;
|
||||
};
|
||||
|
||||
this.toString = function() {
|
||||
var result = '';
|
||||
if(this.scheme !== null) { result = result + this.scheme + ':'; }
|
||||
if(this.authority !== null) { result = result + '//' + this.authority; }
|
||||
if(this.path !== null) { result = result + this.path; }
|
||||
if(this.query !== null) { result = result + '?' + this.query; }
|
||||
if(this.fragment !== null) { result = result + '#' + this.fragment; }
|
||||
return result;
|
||||
};
|
||||
|
||||
this.toAbsolute = function(base) {
|
||||
var base = new jscolor.URI(base);
|
||||
var r = this;
|
||||
var t = new jscolor.URI;
|
||||
|
||||
if(base.scheme === null) { return false; }
|
||||
|
||||
if(r.scheme !== null && r.scheme.toLowerCase() === base.scheme.toLowerCase()) {
|
||||
r.scheme = null;
|
||||
}
|
||||
|
||||
if(r.scheme !== null) {
|
||||
t.scheme = r.scheme;
|
||||
t.authority = r.authority;
|
||||
t.path = removeDotSegments(r.path);
|
||||
t.query = r.query;
|
||||
} else {
|
||||
if(r.authority !== null) {
|
||||
t.authority = r.authority;
|
||||
t.path = removeDotSegments(r.path);
|
||||
t.query = r.query;
|
||||
} else {
|
||||
if(r.path === '') { // TODO: == or === ?
|
||||
t.path = base.path;
|
||||
if(r.query !== null) {
|
||||
t.query = r.query;
|
||||
} else {
|
||||
t.query = base.query;
|
||||
}
|
||||
} else {
|
||||
if(r.path.substr(0,1) === '/') {
|
||||
t.path = removeDotSegments(r.path);
|
||||
} else {
|
||||
if(base.authority !== null && base.path === '') { // TODO: == or === ?
|
||||
t.path = '/'+r.path;
|
||||
} else {
|
||||
t.path = base.path.replace(/[^\/]+$/,'')+r.path;
|
||||
}
|
||||
t.path = removeDotSegments(t.path);
|
||||
}
|
||||
t.query = r.query;
|
||||
}
|
||||
t.authority = base.authority;
|
||||
}
|
||||
t.scheme = base.scheme;
|
||||
}
|
||||
t.fragment = r.fragment;
|
||||
|
||||
return t;
|
||||
};
|
||||
|
||||
function removeDotSegments(path) {
|
||||
var out = '';
|
||||
while(path) {
|
||||
if(path.substr(0,3)==='../' || path.substr(0,2)==='./') {
|
||||
path = path.replace(/^\.+/,'').substr(1);
|
||||
} else if(path.substr(0,3)==='/./' || path==='/.') {
|
||||
path = '/'+path.substr(3);
|
||||
} else if(path.substr(0,4)==='/../' || path==='/..') {
|
||||
path = '/'+path.substr(4);
|
||||
out = out.replace(/\/?[^\/]*$/, '');
|
||||
} else if(path==='.' || path==='..') {
|
||||
path = '';
|
||||
} else {
|
||||
var rm = path.match(/^\/?[^\/]*/)[0];
|
||||
path = path.substr(rm.length);
|
||||
out = out + rm;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
if(uri) {
|
||||
this.parse(uri);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* Usage example:
|
||||
* var myColor = new jscolor.color(myInputElement)
|
||||
*/
|
||||
|
||||
color : function(target, prop) {
|
||||
|
||||
|
||||
this.required = true; // refuse empty values?
|
||||
this.adjust = true; // adjust value to uniform notation?
|
||||
this.hash = false; // prefix color with # symbol?
|
||||
this.caps = true; // uppercase?
|
||||
this.valueElement = target; // value holder
|
||||
this.styleElement = target; // where to reflect current color
|
||||
this.hsv = [0, 0, 1]; // read-only 0-6, 0-1, 0-1
|
||||
this.rgb = [1, 1, 1]; // read-only 0-1, 0-1, 0-1
|
||||
|
||||
this.pickerOnfocus = true; // display picker on focus?
|
||||
this.pickerMode = 'HSV'; // HSV | HVS
|
||||
this.pickerPosition = 'bottom'; // left | right | top | bottom
|
||||
this.pickerFace = 10; // px
|
||||
this.pickerFaceColor = 'ThreeDFace'; // CSS color
|
||||
this.pickerBorder = 1; // px
|
||||
this.pickerBorderColor = 'ThreeDHighlight ThreeDShadow ThreeDShadow ThreeDHighlight'; // CSS color
|
||||
this.pickerInset = 1; // px
|
||||
this.pickerInsetColor = 'ThreeDShadow ThreeDHighlight ThreeDHighlight ThreeDShadow'; // CSS color
|
||||
this.pickerZIndex = 10000;
|
||||
|
||||
|
||||
for(var p in prop) {
|
||||
if(prop.hasOwnProperty(p)) {
|
||||
this[p] = prop[p];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.hidePicker = function() {
|
||||
if(isPickerOwner()) {
|
||||
removePicker();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this.showPicker = function() {
|
||||
if(!isPickerOwner()) {
|
||||
var tp = jscolor.getElementPos(target); // target pos
|
||||
var ts = jscolor.getElementSize(target); // target size
|
||||
var vp = jscolor.getViewPos(); // view pos
|
||||
var vs = jscolor.getViewSize(); // view size
|
||||
var ps = [ // picker size
|
||||
2*this.pickerBorder + 4*this.pickerInset + 2*this.pickerFace + jscolor.images.pad[0] + 2*jscolor.images.arrow[0] + jscolor.images.sld[0],
|
||||
2*this.pickerBorder + 2*this.pickerInset + 2*this.pickerFace + jscolor.images.pad[1]
|
||||
];
|
||||
var a, b, c;
|
||||
switch(this.pickerPosition.toLowerCase()) {
|
||||
case 'left': a=1; b=0; c=-1; break;
|
||||
case 'right':a=1; b=0; c=1; break;
|
||||
case 'top': a=0; b=1; c=-1; break;
|
||||
default: a=0; b=1; c=1; break;
|
||||
}
|
||||
var l = (ts[b]+ps[b])/2;
|
||||
var pp = [ // picker pos
|
||||
-vp[a]+tp[a]+ps[a] > vs[a] ?
|
||||
(-vp[a]+tp[a]+ts[a]/2 > vs[a]/2 && tp[a]+ts[a]-ps[a] >= 0 ? tp[a]+ts[a]-ps[a] : tp[a]) :
|
||||
tp[a],
|
||||
-vp[b]+tp[b]+ts[b]+ps[b]-l+l*c > vs[b] ?
|
||||
(-vp[b]+tp[b]+ts[b]/2 > vs[b]/2 && tp[b]+ts[b]-l-l*c >= 0 ? tp[b]+ts[b]-l-l*c : tp[b]+ts[b]-l+l*c) :
|
||||
(tp[b]+ts[b]-l+l*c >= 0 ? tp[b]+ts[b]-l+l*c : tp[b]+ts[b]-l-l*c)
|
||||
];
|
||||
drawPicker(pp[a] + 10, pp[b] + 1);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this.importColor = function() {
|
||||
if(!valueElement) {
|
||||
this.exportColor();
|
||||
} else {
|
||||
if(!this.adjust) {
|
||||
if(!this.fromString(valueElement.value, leaveValue)) {
|
||||
styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor;
|
||||
styleElement.style.color = styleElement.jscStyle.color;
|
||||
this.exportColor(leaveValue | leaveStyle);
|
||||
}
|
||||
} else if(!this.required && /^\s*$/.test(valueElement.value)) {
|
||||
valueElement.value = '';
|
||||
styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor;
|
||||
styleElement.style.color = styleElement.jscStyle.color;
|
||||
this.exportColor(leaveValue | leaveStyle);
|
||||
|
||||
} else if(this.fromString(valueElement.value)) {
|
||||
// OK
|
||||
} else {
|
||||
this.exportColor();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this.exportColor = function(flags) {
|
||||
if(!(flags & leaveValue) && valueElement) {
|
||||
var value = this.toString();
|
||||
if(this.caps) { value = value.toUpperCase(); }
|
||||
if(this.hash) { value = '#'+value; }
|
||||
valueElement.value = value;
|
||||
}
|
||||
if(!(flags & leaveStyle) && styleElement) {
|
||||
styleElement.style.backgroundColor =
|
||||
'#'+this.toString();
|
||||
styleElement.style.color =
|
||||
0.213 * this.rgb[0] +
|
||||
0.715 * this.rgb[1] +
|
||||
0.072 * this.rgb[2]
|
||||
< 0.5 ? '#FFF' : '#000';
|
||||
}
|
||||
if(!(flags & leavePad) && isPickerOwner()) {
|
||||
redrawPad();
|
||||
}
|
||||
if(!(flags & leaveSld) && isPickerOwner()) {
|
||||
redrawSld();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this.fromHSV = function(h, s, v, flags) { // null = don't change
|
||||
h<0 && (h=0) || h>6 && (h=6);
|
||||
s<0 && (s=0) || s>1 && (s=1);
|
||||
v<0 && (v=0) || v>1 && (v=1);
|
||||
this.rgb = HSV_RGB(
|
||||
h===null ? this.hsv[0] : (this.hsv[0]=h),
|
||||
s===null ? this.hsv[1] : (this.hsv[1]=s),
|
||||
v===null ? this.hsv[2] : (this.hsv[2]=v)
|
||||
);
|
||||
this.exportColor(flags);
|
||||
};
|
||||
|
||||
|
||||
this.fromRGB = function(r, g, b, flags) { // null = don't change
|
||||
r<0 && (r=0) || r>1 && (r=1);
|
||||
g<0 && (g=0) || g>1 && (g=1);
|
||||
b<0 && (b=0) || b>1 && (b=1);
|
||||
var hsv = RGB_HSV(
|
||||
r===null ? this.rgb[0] : (this.rgb[0]=r),
|
||||
g===null ? this.rgb[1] : (this.rgb[1]=g),
|
||||
b===null ? this.rgb[2] : (this.rgb[2]=b)
|
||||
);
|
||||
if(hsv[0] !== null) {
|
||||
this.hsv[0] = hsv[0];
|
||||
}
|
||||
if(hsv[2] !== 0) {
|
||||
this.hsv[1] = hsv[1];
|
||||
}
|
||||
this.hsv[2] = hsv[2];
|
||||
this.exportColor(flags);
|
||||
};
|
||||
|
||||
|
||||
this.fromString = function(hex, flags) {
|
||||
var m = hex.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i);
|
||||
if(!m) {
|
||||
return false;
|
||||
} else {
|
||||
if(m[1].length === 6) { // 6-char notation
|
||||
this.fromRGB(
|
||||
parseInt(m[1].substr(0,2),16) / 255,
|
||||
parseInt(m[1].substr(2,2),16) / 255,
|
||||
parseInt(m[1].substr(4,2),16) / 255,
|
||||
flags
|
||||
);
|
||||
} else { // 3-char notation
|
||||
this.fromRGB(
|
||||
parseInt(m[1].charAt(0)+m[1].charAt(0),16) / 255,
|
||||
parseInt(m[1].charAt(1)+m[1].charAt(1),16) / 255,
|
||||
parseInt(m[1].charAt(2)+m[1].charAt(2),16) / 255,
|
||||
flags
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this.toString = function() {
|
||||
return (
|
||||
(0x100 | Math.round(255*this.rgb[0])).toString(16).substr(1) +
|
||||
(0x100 | Math.round(255*this.rgb[1])).toString(16).substr(1) +
|
||||
(0x100 | Math.round(255*this.rgb[2])).toString(16).substr(1)
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
function RGB_HSV(r, g, b) {
|
||||
var n = Math.min(Math.min(r,g),b);
|
||||
var v = Math.max(Math.max(r,g),b);
|
||||
var m = v - n;
|
||||
if(m === 0) { return [ null, 0, v ]; }
|
||||
var h = r===n ? 3+(b-g)/m : (g===n ? 5+(r-b)/m : 1+(g-r)/m);
|
||||
return [ h===6?0:h, m/v, v ];
|
||||
}
|
||||
|
||||
|
||||
function HSV_RGB(h, s, v) {
|
||||
if(h === null) { return [ v, v, v ]; }
|
||||
var i = Math.floor(h);
|
||||
var f = i%2 ? h-i : 1-(h-i);
|
||||
var m = v * (1 - s);
|
||||
var n = v * (1 - s*f);
|
||||
switch(i) {
|
||||
case 6:
|
||||
case 0: return [v,n,m];
|
||||
case 1: return [n,v,m];
|
||||
case 2: return [m,v,n];
|
||||
case 3: return [m,n,v];
|
||||
case 4: return [n,m,v];
|
||||
case 5: return [v,m,n];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function removePicker() {
|
||||
delete jscolor.picker.owner;
|
||||
document.getElementsByTagName('body')[0].removeChild(jscolor.picker.boxB);
|
||||
}
|
||||
|
||||
|
||||
function drawPicker(x, y) {
|
||||
if(!jscolor.picker) {
|
||||
jscolor.picker = {
|
||||
box : document.createElement('div'),
|
||||
boxB : document.createElement('div'),
|
||||
pad : document.createElement('div'),
|
||||
padB : document.createElement('div'),
|
||||
padM : document.createElement('div'),
|
||||
sld : document.createElement('div'),
|
||||
sldB : document.createElement('div'),
|
||||
sldM : document.createElement('div')
|
||||
};
|
||||
for(var i=0,segSize=4; i<jscolor.images.sld[1]; i+=segSize) {
|
||||
var seg = document.createElement('div');
|
||||
seg.style.height = segSize+'px';
|
||||
seg.style.fontSize = '1px';
|
||||
seg.style.lineHeight = '0';
|
||||
jscolor.picker.sld.appendChild(seg);
|
||||
}
|
||||
jscolor.picker.sldB.appendChild(jscolor.picker.sld);
|
||||
jscolor.picker.box.appendChild(jscolor.picker.sldB);
|
||||
jscolor.picker.box.appendChild(jscolor.picker.sldM);
|
||||
jscolor.picker.padB.appendChild(jscolor.picker.pad);
|
||||
jscolor.picker.box.appendChild(jscolor.picker.padB);
|
||||
jscolor.picker.box.appendChild(jscolor.picker.padM);
|
||||
jscolor.picker.boxB.appendChild(jscolor.picker.box);
|
||||
}
|
||||
|
||||
var p = jscolor.picker;
|
||||
|
||||
// recompute controls positions
|
||||
posPad = [
|
||||
x+THIS.pickerBorder+THIS.pickerFace+THIS.pickerInset,
|
||||
y+THIS.pickerBorder+THIS.pickerFace+THIS.pickerInset ];
|
||||
posSld = [
|
||||
null,
|
||||
y+THIS.pickerBorder+THIS.pickerFace+THIS.pickerInset ];
|
||||
|
||||
// controls interaction
|
||||
p.box.onmouseup =
|
||||
p.box.onmouseout = function() { target.focus(); };
|
||||
p.box.onmousedown = function() { abortBlur=true; };
|
||||
p.box.onmousemove = function(e) { holdPad && setPad(e); holdSld && setSld(e); };
|
||||
p.padM.onmouseup =
|
||||
p.padM.onmouseout = function() { if(holdPad) { holdPad=false; jscolor.fireEvent(valueElement,'change'); } };
|
||||
p.padM.onmousedown = function(e) { holdPad=true; setPad(e); };
|
||||
p.sldM.onmouseup =
|
||||
p.sldM.onmouseout = function() { if(holdSld) { holdSld=false; jscolor.fireEvent(valueElement,'change'); } };
|
||||
p.sldM.onmousedown = function(e) { holdSld=true; setSld(e); };
|
||||
|
||||
// picker
|
||||
p.box.style.width = 4*THIS.pickerInset + 2*THIS.pickerFace + jscolor.images.pad[0] + 2*jscolor.images.arrow[0] + jscolor.images.sld[0] + 'px';
|
||||
p.box.style.height = 2*THIS.pickerInset + 2*THIS.pickerFace + jscolor.images.pad[1] + 'px';
|
||||
|
||||
// picker border
|
||||
p.boxB.style.position = 'absolute';
|
||||
p.boxB.style.clear = 'both';
|
||||
p.boxB.style.left = x+'px';
|
||||
p.boxB.style.top = y+'px';
|
||||
p.boxB.style.zIndex = THIS.pickerZIndex;
|
||||
p.boxB.style.border = THIS.pickerBorder+'px solid';
|
||||
p.boxB.style.borderColor = THIS.pickerBorderColor;
|
||||
p.boxB.style.background = THIS.pickerFaceColor;
|
||||
|
||||
// pad image
|
||||
p.pad.style.width = jscolor.images.pad[0]+'px';
|
||||
p.pad.style.height = jscolor.images.pad[1]+'px';
|
||||
|
||||
// pad border
|
||||
p.padB.style.position = 'absolute';
|
||||
p.padB.style.left = THIS.pickerFace+'px';
|
||||
p.padB.style.top = THIS.pickerFace+'px';
|
||||
p.padB.style.border = THIS.pickerInset+'px solid';
|
||||
p.padB.style.borderColor = THIS.pickerInsetColor;
|
||||
|
||||
// pad mouse area
|
||||
p.padM.style.position = 'absolute';
|
||||
p.padM.style.left = '0';
|
||||
p.padM.style.top = '0';
|
||||
p.padM.style.width = THIS.pickerFace + 2*THIS.pickerInset + jscolor.images.pad[0] + jscolor.images.arrow[0] + 'px';
|
||||
p.padM.style.height = p.box.style.height;
|
||||
p.padM.style.cursor = 'crosshair';
|
||||
|
||||
// slider image
|
||||
p.sld.style.overflow = 'hidden';
|
||||
p.sld.style.width = jscolor.images.sld[0]+'px';
|
||||
p.sld.style.height = jscolor.images.sld[1]+'px';
|
||||
|
||||
// slider border
|
||||
p.sldB.style.position = 'absolute';
|
||||
p.sldB.style.right = THIS.pickerFace+'px';
|
||||
p.sldB.style.top = THIS.pickerFace+'px';
|
||||
p.sldB.style.border = THIS.pickerInset+'px solid';
|
||||
p.sldB.style.borderColor = THIS.pickerInsetColor;
|
||||
|
||||
// slider mouse area
|
||||
p.sldM.style.position = 'absolute';
|
||||
p.sldM.style.right = '0';
|
||||
p.sldM.style.top = '0';
|
||||
p.sldM.style.width = jscolor.images.sld[0] + jscolor.images.arrow[0] + THIS.pickerFace + 2*THIS.pickerInset + 'px';
|
||||
p.sldM.style.height = p.box.style.height;
|
||||
try {
|
||||
p.sldM.style.cursor = 'pointer';
|
||||
} catch(eOldIE) {
|
||||
p.sldM.style.cursor = 'hand';
|
||||
}
|
||||
|
||||
// load images in optimal order
|
||||
switch(modeID) {
|
||||
case 0: var padImg = 'hs.png'; break;
|
||||
case 1: var padImg = 'hv.png'; break;
|
||||
}
|
||||
p.padM.style.background = "url('"+jscolor.getDir()+"cross.gif') no-repeat";
|
||||
p.sldM.style.background = "url('"+jscolor.getDir()+"arrow.gif') no-repeat";
|
||||
p.pad.style.background = "url('"+jscolor.getDir()+padImg+"') 0 0 no-repeat";
|
||||
|
||||
// place pointers
|
||||
redrawPad();
|
||||
redrawSld();
|
||||
|
||||
jscolor.picker.owner = THIS;
|
||||
document.getElementsByTagName('body')[0].appendChild(p.boxB);
|
||||
}
|
||||
|
||||
|
||||
function redrawPad() {
|
||||
// redraw the pad pointer
|
||||
switch(modeID) {
|
||||
case 0: var yComponent = 1; break;
|
||||
case 1: var yComponent = 2; break;
|
||||
}
|
||||
var x = Math.round((THIS.hsv[0]/6) * (jscolor.images.pad[0]-1));
|
||||
var y = Math.round((1-THIS.hsv[yComponent]) * (jscolor.images.pad[1]-1));
|
||||
jscolor.picker.padM.style.backgroundPosition =
|
||||
(THIS.pickerFace+THIS.pickerInset+x - Math.floor(jscolor.images.cross[0]/2)) + 'px ' +
|
||||
(THIS.pickerFace+THIS.pickerInset+y - Math.floor(jscolor.images.cross[1]/2)) + 'px';
|
||||
|
||||
// redraw the slider image
|
||||
var seg = jscolor.picker.sld.childNodes;
|
||||
|
||||
switch(modeID) {
|
||||
case 0:
|
||||
var rgb = HSV_RGB(THIS.hsv[0], THIS.hsv[1], 1);
|
||||
for(var i=0; i<seg.length; i+=1) {
|
||||
seg[i].style.backgroundColor = 'rgb('+
|
||||
(rgb[0]*(1-i/seg.length)*100)+'%,'+
|
||||
(rgb[1]*(1-i/seg.length)*100)+'%,'+
|
||||
(rgb[2]*(1-i/seg.length)*100)+'%)';
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
var rgb, s, c = [ THIS.hsv[2], 0, 0 ];
|
||||
var i = Math.floor(THIS.hsv[0]);
|
||||
var f = i%2 ? THIS.hsv[0]-i : 1-(THIS.hsv[0]-i);
|
||||
switch(i) {
|
||||
case 6:
|
||||
case 0: rgb=[0,1,2]; break;
|
||||
case 1: rgb=[1,0,2]; break;
|
||||
case 2: rgb=[2,0,1]; break;
|
||||
case 3: rgb=[2,1,0]; break;
|
||||
case 4: rgb=[1,2,0]; break;
|
||||
case 5: rgb=[0,2,1]; break;
|
||||
}
|
||||
for(var i=0; i<seg.length; i+=1) {
|
||||
s = 1 - 1/(seg.length-1)*i;
|
||||
c[1] = c[0] * (1 - s*f);
|
||||
c[2] = c[0] * (1 - s);
|
||||
seg[i].style.backgroundColor = 'rgb('+
|
||||
(c[rgb[0]]*100)+'%,'+
|
||||
(c[rgb[1]]*100)+'%,'+
|
||||
(c[rgb[2]]*100)+'%)';
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function redrawSld() {
|
||||
// redraw the slider pointer
|
||||
switch(modeID) {
|
||||
case 0: var yComponent = 2; break;
|
||||
case 1: var yComponent = 1; break;
|
||||
}
|
||||
var y = Math.round((1-THIS.hsv[yComponent]) * (jscolor.images.sld[1]-1));
|
||||
jscolor.picker.sldM.style.backgroundPosition =
|
||||
'0 ' + (THIS.pickerFace+THIS.pickerInset+y - Math.floor(jscolor.images.arrow[1]/2)) + 'px';
|
||||
}
|
||||
|
||||
|
||||
function isPickerOwner() {
|
||||
return jscolor.picker && jscolor.picker.owner === THIS;
|
||||
}
|
||||
|
||||
|
||||
function blurTarget() {
|
||||
if(valueElement === target) {
|
||||
THIS.importColor();
|
||||
}
|
||||
if(THIS.pickerOnfocus) {
|
||||
THIS.hidePicker();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function blurValue() {
|
||||
if(valueElement !== target) {
|
||||
THIS.importColor();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function setPad(e) {
|
||||
var posM = jscolor.getMousePos(e);
|
||||
var x = posM[0]-posPad[0];
|
||||
var y = posM[1]-posPad[1];
|
||||
switch(modeID) {
|
||||
case 0: THIS.fromHSV(x*(6/(jscolor.images.pad[0]-1)), 1 - y/(jscolor.images.pad[1]-1), null, leaveSld); break;
|
||||
case 1: THIS.fromHSV(x*(6/(jscolor.images.pad[0]-1)), null, 1 - y/(jscolor.images.pad[1]-1), leaveSld); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function setSld(e) {
|
||||
var posM = jscolor.getMousePos(e);
|
||||
var y = posM[1]-posPad[1];
|
||||
switch(modeID) {
|
||||
case 0: THIS.fromHSV(null, null, 1 - y/(jscolor.images.sld[1]-1), leavePad); break;
|
||||
case 1: THIS.fromHSV(null, 1 - y/(jscolor.images.sld[1]-1), null, leavePad); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var THIS = this;
|
||||
var modeID = this.pickerMode.toLowerCase()==='hvs' ? 1 : 0;
|
||||
var abortBlur = false;
|
||||
var
|
||||
valueElement = jscolor.fetchElement(this.valueElement),
|
||||
styleElement = jscolor.fetchElement(this.styleElement);
|
||||
var
|
||||
holdPad = false,
|
||||
holdSld = false;
|
||||
var
|
||||
posPad,
|
||||
posSld;
|
||||
var
|
||||
leaveValue = 1<<0,
|
||||
leaveStyle = 1<<1,
|
||||
leavePad = 1<<2,
|
||||
leaveSld = 1<<3;
|
||||
|
||||
// target
|
||||
jscolor.addEvent(target, 'focus', function() {
|
||||
if(THIS.pickerOnfocus) { THIS.showPicker(); }
|
||||
});
|
||||
jscolor.addEvent(target, 'blur', function() {
|
||||
if(!abortBlur) {
|
||||
window.setTimeout(function(){ abortBlur || blurTarget(); abortBlur=false; }, 0);
|
||||
} else {
|
||||
abortBlur = false;
|
||||
}
|
||||
});
|
||||
|
||||
// valueElement
|
||||
if(valueElement) {
|
||||
var updateField = function() {
|
||||
THIS.fromString(valueElement.value, leaveValue);
|
||||
};
|
||||
jscolor.addEvent(valueElement, 'keyup', updateField);
|
||||
jscolor.addEvent(valueElement, 'input', updateField);
|
||||
jscolor.addEvent(valueElement, 'blur', blurValue);
|
||||
valueElement.setAttribute('autocomplete', 'off');
|
||||
}
|
||||
|
||||
// styleElement
|
||||
if(styleElement) {
|
||||
styleElement.jscStyle = {
|
||||
backgroundColor : styleElement.style.backgroundColor,
|
||||
color : styleElement.style.color
|
||||
};
|
||||
}
|
||||
|
||||
// require images
|
||||
switch(modeID) {
|
||||
case 0: jscolor.requireImage('hs.png'); break;
|
||||
case 1: jscolor.requireImage('hv.png'); break;
|
||||
}
|
||||
jscolor.requireImage('cross.gif');
|
||||
jscolor.requireImage('arrow.gif');
|
||||
|
||||
this.importColor();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
jscolor.install();
|
@ -0,0 +1,19 @@
|
||||
/*
|
||||
jQuery Tools 1.2.5 Rangeinput - HTML5 <input type="range" /> for humans
|
||||
|
||||
NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
|
||||
|
||||
http://flowplayer.org/tools/rangeinput/
|
||||
|
||||
Since: Mar 2010
|
||||
Date: Wed Sep 22 06:02:10 2010 +0000
|
||||
*/
|
||||
(function(e){function F(d,a){a=Math.pow(10,a);return Math.round(d*a)/a}function q(d,a){if(a=parseInt(d.css(a),10))return a;return(d=d[0].currentStyle)&&d.width&&parseInt(d.width,10)}function C(d){return(d=d.data("events"))&&d.onSlide}function G(d,a){function h(c,b,f,j){if(f===undefined)f=b/k*z;else if(j)f-=a.min;if(s)f=Math.round(f/s)*s;if(b===undefined||s)b=f*k/z;if(isNaN(f))return g;b=Math.max(0,Math.min(b,k));f=b/k*z;if(j||!n)f+=a.min;if(n)if(j)b=k-b;else f=a.max-f;f=F(f,t);var r=c.type=="click";
|
||||
if(D&&l!==undefined&&!r){c.type="onSlide";A.trigger(c,[f,b]);if(c.isDefaultPrevented())return g}j=r?a.speed:0;r=r?function(){c.type="change";A.trigger(c,[f])}:null;if(n){m.animate({top:b},j,r);a.progress&&B.animate({height:k-b+m.width()/2},j)}else{m.animate({left:b},j,r);a.progress&&B.animate({width:b+m.width()/2},j)}l=f;H=b;d.val(f);return g}function o(){if(n=a.vertical||q(i,"height")>q(i,"width")){k=q(i,"height")-q(m,"height");u=i.offset().top+k}else{k=q(i,"width")-q(m,"width");u=i.offset().left}}
|
||||
function v(){o();g.setValue(a.value!==undefined?a.value:a.min)}var g=this,p=a.css,i=e("<div><div/><a href='#'/></div>").data("rangeinput",g),n,l,u,k,H;d.before(i);var m=i.addClass(p.slider).find("a").addClass(p.handle),B=i.find("div").addClass(p.progress);e.each("min,max,step,value".split(","),function(c,b){c=d.attr(b);if(parseFloat(c))a[b]=parseFloat(c,10)});var z=a.max-a.min,s=a.step=="any"?0:a.step,t=a.precision;if(t===undefined)try{t=s.toString().split(".")[1].length}catch(I){t=0}if(d.attr("type")==
|
||||
"range"){var w=e("<input/>");e.each("class,disabled,id,maxlength,name,readonly,required,size,style,tabindex,title,value".split(","),function(c,b){w.attr(b,d.attr(b))});w.val(a.value);d.replaceWith(w);d=w}d.addClass(p.input);var A=e(g).add(d),D=true;e.extend(g,{getValue:function(){return l},setValue:function(c,b){o();return h(b||e.Event("api"),undefined,c,true)},getConf:function(){return a},getProgress:function(){return B},getHandle:function(){return m},getInput:function(){return d},step:function(c,
|
||||
b){b=b||e.Event();var f=a.step=="any"?1:a.step;g.setValue(l+f*(c||1),b)},stepUp:function(c){return g.step(c||1)},stepDown:function(c){return g.step(-c||-1)}});e.each("onSlide,change".split(","),function(c,b){e.isFunction(a[b])&&e(g).bind(b,a[b]);g[b]=function(f){f&&e(g).bind(b,f);return g}});m.drag({drag:false}).bind("dragStart",function(){o();D=C(e(g))||C(d)}).bind("drag",function(c,b,f){if(d.is(":disabled"))return false;h(c,n?b:f)}).bind("dragEnd",function(c){if(!c.isDefaultPrevented()){c.type=
|
||||
"change";A.trigger(c,[l])}}).click(function(c){return c.preventDefault()});i.click(function(c){if(d.is(":disabled")||c.target==m[0])return c.preventDefault();o();var b=m.width()/2;h(c,n?k-u-b+c.pageY:c.pageX-u-b)});a.keyboard&&d.keydown(function(c){if(!d.attr("readonly")){var b=c.keyCode,f=e([75,76,38,33,39]).index(b)!=-1,j=e([74,72,40,34,37]).index(b)!=-1;if((f||j)&&!(c.shiftKey||c.altKey||c.ctrlKey)){if(f)g.step(b==33?10:1,c);else if(j)g.step(b==34?-10:-1,c);return c.preventDefault()}}});d.blur(function(c){var b=
|
||||
e(this).val();b!==l&&g.setValue(b,c)});e.extend(d[0],{stepUp:g.stepUp,stepDown:g.stepDown});v();k||e(window).load(v)}e.tools=e.tools||{version:"1.2.5"};var E;E=e.tools.rangeinput={conf:{min:0,max:100,step:"any",steps:0,value:0,precision:undefined,vertical:0,keyboard:true,progress:false,speed:100,css:{input:"range",slider:"slider",progress:"progress",handle:"handle"}}};var x,y;e.fn.drag=function(d){document.ondragstart=function(){return false};d=e.extend({x:true,y:true,drag:true},d);x=x||e(document).bind("mousedown mouseup",
|
||||
function(a){var h=e(a.target);if(a.type=="mousedown"&&h.data("drag")){var o=h.position(),v=a.pageX-o.left,g=a.pageY-o.top,p=true;x.bind("mousemove.drag",function(i){var n=i.pageX-v;i=i.pageY-g;var l={};if(d.x)l.left=n;if(d.y)l.top=i;if(p){h.trigger("dragStart");p=false}d.drag&&h.css(l);h.trigger("drag",[i,n]);y=h});a.preventDefault()}else try{y&&y.trigger("dragEnd")}finally{x.unbind("mousemove.drag");y=null}});return this.data("drag",true)};e.expr[":"].range=function(d){var a=d.getAttribute("type");
|
||||
return a&&a=="range"||!!e(d).filter("input").data("rangeinput")};e.fn.rangeinput=function(d){if(this.data("rangeinput"))return this;d=e.extend(true,{},E.conf,d);var a;this.each(function(){var h=new G(e(this),e.extend(true,{},d));h=h.getInput().data("rangeinput",h);a=a?a.add(h):h});return a?a:this}})(jQuery);
|
@ -0,0 +1,328 @@
|
||||
var $pk_aj = jQuery.noConflict();
|
||||
$pk_aj(document).ready(function() {
|
||||
|
||||
$pk_aj('#pk_sc_table_selector_generate_shortcode_button').hide();
|
||||
|
||||
$pk_aj('.pk_admin_input_slider').rangeinput();
|
||||
$pk_aj('.pk_admin_input_slider').change(function(event) {
|
||||
|
||||
$pk_aj(this).data("rangeinput").setValue($pk_aj(this).val());
|
||||
|
||||
});
|
||||
|
||||
$pk_aj('.pk_admin_input_select_box').change(function(event) {
|
||||
|
||||
var count = 0;
|
||||
|
||||
$pk_aj(this).find('option').each(function() {
|
||||
|
||||
if (count > 0) {
|
||||
|
||||
$pk_aj('.' + $pk_aj(this).val().split(',')[0]).hide();
|
||||
$pk_aj('#' + $pk_aj(this).val().split(',')[0]).hide();
|
||||
|
||||
}
|
||||
|
||||
count++;
|
||||
|
||||
});
|
||||
|
||||
$pk_aj('.' + $pk_aj(this).val().split(',')[0]).show();
|
||||
$pk_aj('#' + $pk_aj(this).val().split(',')[0]).show();
|
||||
|
||||
});
|
||||
|
||||
$pk_aj('.pk_admin_input_select_box').change();
|
||||
|
||||
$pk_aj('.pk_admin_multiple_checkbox').change(function(event) {
|
||||
|
||||
pkCheckMultipleFields();
|
||||
|
||||
});
|
||||
|
||||
$pk_aj('.pk_admin_input_select_multiple').change(function(event) {
|
||||
|
||||
pkCheckMultipleFields();
|
||||
|
||||
});
|
||||
|
||||
function pkCheckMultipleFields() {
|
||||
|
||||
$pk_aj('.pk_admin_multiple_field').each(function() {
|
||||
|
||||
var main = $pk_aj(this).attr('name');
|
||||
var result = '';
|
||||
|
||||
$pk_aj('.pk_admin_multiple_checkbox[data-main="' + main + '"]').each(function() {
|
||||
|
||||
if ($pk_aj(this).is(':checked')) {
|
||||
|
||||
(result == '') ? result += $pk_aj(this).attr('value') : result += ',' + $pk_aj(this).attr('value');
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$pk_aj('.pk_admin_input_select_multiple[data-main="' + main + '"]').find('option').each(function() {
|
||||
|
||||
if ($pk_aj(this).is(':selected')) {
|
||||
|
||||
(result == '') ? result += $pk_aj(this).val() : result += ',' + $pk_aj(this).val();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$pk_aj(this).val(result);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function pk_sc_create_generate_shortcode_button() {
|
||||
|
||||
$pk_aj('.pk_admin_sc_div').each(function() {
|
||||
|
||||
var shortcode_type = $pk_aj(this).attr('class').split(' ')[2].split('pk_sc_')[1];
|
||||
|
||||
$pk_aj('#pk_sc_table_' + shortcode_type + '_generate_shortcode_button').click(function(event) {
|
||||
|
||||
pk_sc_send_to_editor(shortcode_type);
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
pk_sc_create_generate_shortcode_button();
|
||||
|
||||
function pk_sc_send_to_editor(type) {
|
||||
|
||||
switch (type) {
|
||||
|
||||
case 'box':
|
||||
|
||||
var box_width = $pk_aj('.pk_sc_box').find('[name="pk_sc_box_width"]').val();
|
||||
var box_content = $pk_aj('.pk_sc_box').find('[name="pk_sc_box_content"]').val();
|
||||
|
||||
box_width = (box_width == '0') ? box_width = 'width:100%;' : box_width = 'width:' + box_width + 'px;';
|
||||
|
||||
window.send_to_editor('\n<div class="pk_box" style="' + box_width + '">\n<div class="pk_box_content_wrapper">\n<div class="pk_box_content">\n' + box_content + '\n</div>\n</div>\n</div>\n');
|
||||
break;
|
||||
|
||||
case 'message_box':
|
||||
|
||||
var message_box_width = $pk_aj('.pk_sc_message_box').find('[name="pk_sc_message_box_width"]').val();
|
||||
var message_box_type = $pk_aj('.pk_sc_message_box').find('[name="pk_sc_message_box_type"]').val();
|
||||
var message_box_content = $pk_aj('.pk_sc_message_box').find('[name="pk_sc_message_box_content"]').val();
|
||||
|
||||
message_box_width = (message_box_width == '0') ? message_box_width = 'width:100%;' : message_box_width = 'width:' + message_box_width + 'px;';
|
||||
message_box_type = 'pk_' + message_box_type + '_box';
|
||||
|
||||
window.send_to_editor('\n<div class="pk_message_box ' + message_box_type + '" style="' + message_box_width + '">\n<div class="pk_message_box_content_wrapper">\n<div class="pk_message_box_content">\n' + message_box_content + '\n</div>\n</div>\n</div>\n');
|
||||
break;
|
||||
|
||||
case 'buttons':
|
||||
|
||||
var button_label = $pk_aj('.pk_sc_buttons').find('[name="pk_sc_buttons_label"]').val();
|
||||
var button_size = $pk_aj('.pk_sc_buttons').find('[name="pk_sc_buttons_size"]').val();
|
||||
var button_color = $pk_aj('.pk_sc_buttons').find('[name="pk_sc_buttons_color"]').val();
|
||||
var button_icon = $pk_aj('.pk_sc_buttons').find('[name="pk_sc_buttons_icon"]').val();
|
||||
var button_link = $pk_aj('.pk_sc_buttons').find('[name="pk_sc_buttons_link"]').val();
|
||||
var button_link_target = $pk_aj('.pk_sc_buttons').find('[name="pk_sc_buttons_link_target"]').val();
|
||||
var button_title = $pk_aj('.pk_sc_buttons').find('[name="pk_sc_buttons_title"]').val();
|
||||
|
||||
button_color = (button_color != '') ? ' pk_button_' + button_color : '';
|
||||
button_icon = (button_icon != '') ? ' pk_button_with_icon pk_' + button_icon + '_icon' : '';
|
||||
|
||||
window.send_to_editor('\n<a href="' + button_link + '" class="pk_button_' + button_size + button_color + button_icon + '" target="' + button_link_target + '" title="' + button_title + '"><span>' + button_label + '</span></a>\n');
|
||||
break;
|
||||
|
||||
case 'columns':
|
||||
|
||||
var column = $pk_aj('.pk_sc_columns').find('[name="pk_sc_columns_size"]').val();
|
||||
var column_content = $pk_aj('.pk_sc_columns').find('[name="pk_sc_columns_content"]').val();
|
||||
|
||||
window.send_to_editor('\n<div class="' + column + '">\n\t' + column_content + '\n</div>\n');
|
||||
break;
|
||||
|
||||
case 'dividers':
|
||||
|
||||
var divider = '';
|
||||
var dividers_type = $pk_aj('.pk_sc_dividers').find('[name="pk_sc_dividers_type"]').val();
|
||||
var dividers_height = '';
|
||||
|
||||
if ($pk_aj('.pk_sc_dividers').find('[name="pk_sc_dividers_type"]').val() == 'pk_empty_space') {
|
||||
|
||||
dividers_height = ' style="height:' + $pk_aj('.pk_sc_dividers').find('[name="pk_sc_dividers_height"]').val() + 'px;"';
|
||||
|
||||
}
|
||||
|
||||
if (dividers_type == 'pk_clear_both') divider = '<span class="pk_clear_both"></span>';
|
||||
if (dividers_type == 'pk_empty_space') divider = '<div class="pk_empty_space"' + dividers_height + '></div>';
|
||||
if (dividers_type == 'pk_divider') divider = '<div class="pk_divider"><hr /></div>';
|
||||
if (dividers_type == 'pk_divider_top') divider = '<div class="pk_divider pk_top"><hr /><a href="#" title="top">top</a></div>';
|
||||
|
||||
window.send_to_editor('\n' + divider + '\n');
|
||||
break;
|
||||
|
||||
case 'google_maps':
|
||||
|
||||
var map_height = $pk_aj('.pk_sc_google_maps').find('[name="pk_sc_google_maps_map_height"]').val();
|
||||
var map_url = $pk_aj('.pk_sc_google_maps').find('[name="pk_sc_google_maps_map_url"]').val().replace('#038;', '&');
|
||||
|
||||
window.send_to_editor('\n<iframe src="' + map_url + '&output=embed" style="width:100%; height:' + map_height + 'px;"></iframe>\n');
|
||||
break;
|
||||
|
||||
case 'pricing_tables':
|
||||
|
||||
var layout_columns = Number($pk_aj('.pk_sc_pricing_tables').find('[name="pk_sc_pricing_tables_layout_columns"]').val());
|
||||
var layout_rows = Number($pk_aj('.pk_sc_pricing_tables').find('[name="pk_sc_pricing_tables_layout_rows"]').val());
|
||||
var highlight = Number($pk_aj('.pk_sc_pricing_tables').find('[name="pk_sc_pricing_tables_highlight"]').val());
|
||||
var highlight_color = $pk_aj('.pk_sc_pricing_tables').find('[name="pk_sc_pricing_tables_highlight_color"]').val();
|
||||
|
||||
var table_output = '\n<div class="pk_pricing_table pk_pricing_' + ((layout_columns == 2) ? 'two' : ((layout_columns == 3) ? 'three' : ((layout_columns == 4) ? 'four' : 'five'))) + '_columns' + ((highlight != 0) ? ' pk_pricing_with_highlight' + highlight_color : '') + ' pk_clearfix">\n';
|
||||
|
||||
for (var i = 1; i <= layout_columns; i++) {
|
||||
|
||||
table_output += '\n<div class="pk_column' + ((layout_columns == 2) ? ' pk_one_half' : ((layout_columns == 3) ? ' pk_one_third' : ((layout_columns == 4) ? ' pk_one_fourth' : ' pk_one_fifth'))) + ((i == highlight) ? ' pk_highlight_column' : '') + ((i == 1) ? ' pk_first' : ((i == layout_columns) ? ' pk_last' : '')) + '">\n';
|
||||
|
||||
table_output += '<header>';
|
||||
table_output += '\n<p class="pk_type"><span>Plan</span></p>';
|
||||
table_output += '\n<p class="pk_price">$99.<sup>99</sup><span>per month</span></p>';
|
||||
table_output += '\n</header>\n<ul>\n';
|
||||
|
||||
for (var l = 0; l < layout_rows; l++) {
|
||||
|
||||
table_output += '<li' + ((l % 2) ? ' class="pk_alternate_color"' : '') + '>Row text here</li>\n';
|
||||
|
||||
}
|
||||
|
||||
table_output += '</ul>\n<footer>';
|
||||
table_output += '\n<p class="pk_button_wrapper"><a href="#" class="pk_button_small pk_button_' + ((i == highlight) ? 'grey' : 'white') + '"><span>Sign Up</span></a></p>';
|
||||
table_output += '\n</footer>\n';
|
||||
|
||||
table_output += '</div>\n';
|
||||
|
||||
}
|
||||
|
||||
table_output += '\n</div>\n';
|
||||
|
||||
window.send_to_editor(table_output);
|
||||
break;
|
||||
|
||||
case 'tabs':
|
||||
|
||||
var tabs_title = $pk_aj('.pk_sc_tabs').find('[name="pk_sc_tabs_title"]').val();
|
||||
var tabs_number = Number($pk_aj('.pk_sc_tabs').find('[name="pk_sc_tabs_number"]').val());
|
||||
var tabs_width = $pk_aj('.pk_sc_tabs').find('[name="pk_sc_tabs_width"]').val();
|
||||
|
||||
tabs_width = (tabs_width == '0') ? tabs_width = 'width:100%;' : tabs_width = 'width:' + tabs_width + 'px;';
|
||||
|
||||
var tabs_output = '\n<div class="pk_tabs" style="' + tabs_width + '">\n<h4 class="pk_tabs_label">' + tabs_title + '</h4>\n<ul class="pk_tabs_navigation">\n';
|
||||
|
||||
for (var i = 0; i < tabs_number; i++) {
|
||||
|
||||
tabs_output += '<li><a title="Tab ' + (i + 1) + '" href="#">Tab ' + (i + 1) + '</a></li>\n';
|
||||
|
||||
}
|
||||
|
||||
tabs_output += '</ul>\n<div class="pk_tabs_content">\n';
|
||||
|
||||
for (var i = 0; i < tabs_number; i++) {
|
||||
|
||||
tabs_output += '<div class="pk_tab">\n<p>Tab ' + (i + 1) + ' content here...</p>\n</div>\n';
|
||||
|
||||
}
|
||||
|
||||
tabs_output += '</div>\n</div>\n';
|
||||
|
||||
window.send_to_editor(tabs_output);
|
||||
break;
|
||||
|
||||
case 'toggles':
|
||||
|
||||
var toggles_width = $pk_aj('.pk_sc_toggles').find('[name="pk_sc_toggles_width"]').val();
|
||||
var toggles_accordion = $pk_aj('.pk_sc_toggles').find('[name="pk_sc_toggles_accordion"]').val();
|
||||
var toggles_number = Number($pk_aj('.pk_sc_toggles').find('[name="pk_sc_toggles_number"]').val());
|
||||
|
||||
toggles_width = (toggles_width == '0') ? toggles_width = 'width:100%;' : toggles_width = 'width:' + toggles_width + 'px;';
|
||||
|
||||
var toggles_output = '\n<div class="pk_toggles' + toggles_accordion + '" style="' + toggles_width + '">\n';
|
||||
|
||||
for (var i = 0; i < toggles_number; i++) {
|
||||
|
||||
toggles_output += '<div class="pk_toggle">\n<p class="pk_toggle_button">Toggle ' + (i + 1) + '</p>\n<div class="pk_toggle_content_wrapper">\n<div class="pk_toggle_content">\n<p>Toggle ' + (i + 1) + ' content here...</p>\n</div>\n</div>\n</div>\n';
|
||||
|
||||
}
|
||||
|
||||
toggles_output += '</div>\n';
|
||||
|
||||
window.send_to_editor(toggles_output);
|
||||
break;
|
||||
|
||||
case 'typography_hu':
|
||||
|
||||
var size = $pk_aj('.pk_sc_typography_hu').find('[name="pk_sc_typography_hu_size"]').val();
|
||||
var heading = $pk_aj('.pk_sc_typography_hu').find('[name="pk_sc_typography_hu_heading"]').val();
|
||||
|
||||
window.send_to_editor('\n<' + size + ' class="pk_heading_underline">' + heading + '</' + size + '>\n');
|
||||
break;
|
||||
|
||||
case 'typography_hb':
|
||||
|
||||
var color = $pk_aj('.pk_sc_typography_hb').find('[name="pk_sc_typography_hb_color"]').val();
|
||||
var background_color = $pk_aj('.pk_sc_typography_hb').find('[name="pk_sc_typography_hb_background_color"]').val();
|
||||
var rounded = $pk_aj('.pk_sc_typography_hb').find('[name="pk_sc_typography_hb_rounded"]').val();
|
||||
var size = $pk_aj('.pk_sc_typography_hb').find('[name="pk_sc_typography_hb_size"]').val();
|
||||
var heading = $pk_aj('.pk_sc_typography_hb').find('[name="pk_sc_typography_hb_heading"]').val();
|
||||
|
||||
window.send_to_editor('\n<' + size + ' class="pk_heading_underline' + rounded + '" style="color:' + color + '; background-color:' + background_color + ';">' + heading + '</' + size + '>\n');
|
||||
break;
|
||||
|
||||
case 'typography_quote':
|
||||
|
||||
var width = $pk_aj('.pk_sc_typography_quote').find('[name="pk_sc_typography_quote_width"]').val();
|
||||
var quote = $pk_aj('.pk_sc_typography_quote').find('[name="pk_sc_typography_quote_quote"]').val();
|
||||
var cite = $pk_aj('.pk_sc_typography_quote').find('[name="pk_sc_typography_quote_cite"]').val();
|
||||
|
||||
window.send_to_editor('\n<blockquote' + ((width == 0) ? '' : ' style="width:' + width + 'px;"' ) + '><p>' + quote + '</p><cite>' + cite + '</cite></blockquote>\n');
|
||||
break;
|
||||
|
||||
case 'typography_lists':
|
||||
|
||||
var style = $pk_aj('.pk_sc_typography_lists').find('[name="pk_sc_typography_lists_style"]').val();
|
||||
var list = $pk_aj('.pk_sc_typography_lists').find('[name="pk_sc_typography_lists_list"]').val();
|
||||
|
||||
window.send_to_editor('\n' + list.replace('<ul>', '<ul class="' + style + '">') + ']\n');
|
||||
break;
|
||||
|
||||
case 'typography_hl':
|
||||
|
||||
var color = $pk_aj('.pk_sc_typography_hl').find('[name="pk_sc_typography_hl_color"]').val();
|
||||
var background_color = $pk_aj('.pk_sc_typography_hl').find('[name="pk_sc_typography_hl_background_color"]').val();
|
||||
var rounded = $pk_aj('.pk_sc_typography_hl').find('[name="pk_sc_typography_hl_rounded"]').val();
|
||||
var content = $pk_aj('.pk_sc_typography_hl').find('[name="pk_sc_typography_hl_content"]').val();
|
||||
|
||||
window.send_to_editor('\n<span class="pk_highlight' + rounded + '" style="color:' + color + '; background-color:' + background_color + ';">' + content + '</span>\n');
|
||||
break;
|
||||
|
||||
case 'typography_dc':
|
||||
|
||||
var type = $pk_aj('.pk_sc_typography_dc').find('[name="pk_sc_typography_dc_type"]').val();
|
||||
var color = $pk_aj('.pk_sc_typography_dc').find('[name="pk_sc_typography_dc_color"]').val();
|
||||
var text = $pk_aj('.pk_sc_typography_dc').find('[name="pk_sc_typography_dc_text"]').val();
|
||||
|
||||
window.send_to_editor('\n<span class="' + type + color + '">' + text + '</span>\n');
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
});
|
@ -0,0 +1,399 @@
|
||||
<?php
|
||||
|
||||
require_once(PK_FRAMEWORK.'/shortcodes/pk_shortcodes_manager_generator.php');
|
||||
require_once(PK_FRAMEWORK.'/shortcodes/pk_shortcodes_manager.php');
|
||||
|
||||
function pk_enqueue_shortcodes_scripts() {
|
||||
|
||||
wp_enqueue_script('jquery');
|
||||
|
||||
wp_deregister_script('pk_rangeinput');
|
||||
wp_register_script('pk_rangeinput', PK_THEME_DIR.'/framework/shortcodes/js/pk_rangeinput.js');
|
||||
wp_enqueue_script('pk_rangeinput');
|
||||
|
||||
wp_deregister_script('jscolor');
|
||||
wp_register_script('jscolor', PK_THEME_DIR.'/framework/shortcodes/js/jscolor/jscolor.js');
|
||||
wp_enqueue_script('jscolor');
|
||||
|
||||
wp_deregister_script('pk_shortcodes_manager');
|
||||
wp_register_script('pk_shortcodes_manager', PK_THEME_DIR.'/framework/shortcodes/js/pk_shortcodes_manager.js');
|
||||
wp_enqueue_script('pk_shortcodes_manager');
|
||||
|
||||
wp_deregister_style('pk_shortcodes_manager');
|
||||
wp_register_style('pk_shortcodes_manager', PK_THEME_DIR.'/framework/shortcodes/css/pk_shortcodes_manager.css');
|
||||
wp_enqueue_style('pk_shortcodes_manager');
|
||||
|
||||
}
|
||||
|
||||
add_action('admin_enqueue_scripts', 'pk_enqueue_shortcodes_scripts');
|
||||
|
||||
$pk_shortcodes = array();
|
||||
|
||||
$pk_shortcodes['title'] = __('Generator', 'pk_translate');
|
||||
|
||||
$pk_shortcodes['type'][] = 'selector';
|
||||
$pk_shortcodes['options'][] = array(
|
||||
|
||||
'shortcode_type' => array('title' => __('Select:', 'pk_translate'), 'type' => 'metabox_selector',
|
||||
|
||||
'values' => array(
|
||||
'pk_sc_selector',
|
||||
'pk_sc_box',
|
||||
'pk_sc_message_box',
|
||||
'pk_sc_buttons',
|
||||
'pk_sc_columns',
|
||||
'pk_sc_dividers',
|
||||
'pk_sc_google_maps',
|
||||
'pk_sc_pricing_tables',
|
||||
'pk_sc_tabs',
|
||||
'pk_sc_toggles',
|
||||
'pk_sc_typography_hu',
|
||||
'pk_sc_typography_hb',
|
||||
'pk_sc_typography_quote',
|
||||
'pk_sc_typography_lists',
|
||||
'pk_sc_typography_hl',
|
||||
'pk_sc_typography_dc'),
|
||||
|
||||
'labels' => array(
|
||||
__('-- Select --', 'pk_translate'),
|
||||
__('Box', 'pk_translate'),
|
||||
__('Box (styled)', 'pk_translate'),
|
||||
__('Buttons', 'pk_translate'),
|
||||
__('Columns', 'pk_translate'),
|
||||
__('Dividers', 'pk_translate'),
|
||||
__('Google Maps', 'pk_translate'),
|
||||
__('Pricing Tables', 'pk_translate'),
|
||||
__('Tabs', 'pk_translate'),
|
||||
__('Toggles', 'pk_translate'),
|
||||
__('Typography (heading underline)', 'pk_translate'),
|
||||
__('Typography (heading background)', 'pk_translate'),
|
||||
__('Typography (quote)', 'pk_translate'),
|
||||
__('Typography (lists)', 'pk_translate'),
|
||||
__('Typography (highlight)', 'pk_translate'),
|
||||
__('Typography (drop caps)', 'pk_translate')),
|
||||
|
||||
'helper' => __('Select the HTML element that you want to set up and generate. <strong>Be sure to generate the HTML elements within the HTML tab of the editor.</strong>', 'pk_translate'))
|
||||
|
||||
);
|
||||
$pk_shortcodes['values'][] = array(
|
||||
|
||||
'shortcode_type' => 'pk_shortcodes_table_selector'
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
* Box
|
||||
*/
|
||||
|
||||
$pk_shortcodes['type'][] = 'box';
|
||||
$pk_shortcodes['options'][] = array(
|
||||
|
||||
'box_width' => array('title' => __('Width:', 'pk_translate'), 'type' => 'slider', 'min' => '0', 'max' => '940', 'uom' => 'px', 'helper' => __('Set the box width. Set <i>0</i> for a full width box.', 'pk_translate')),
|
||||
'box_content' => array('title' => __('Content:', 'pk_translate'), 'type' => 'text_area', 'rows' => '10', 'helper' => __('Type here the box content. You can leave this field empty and type the content directly in the main editor.', 'pk_translate'))
|
||||
|
||||
);
|
||||
$pk_shortcodes['values'][] = array(
|
||||
|
||||
'box_width' => '0',
|
||||
'box_content' => ''
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
* Box (message)
|
||||
*/
|
||||
|
||||
$pk_shortcodes['type'][] = 'message_box';
|
||||
$pk_shortcodes['options'][] = array(
|
||||
|
||||
'message_box_width' => array('title' => __('Width:', 'pk_translate'), 'type' => 'slider', 'min' => '0', 'max' => '940', 'uom' => 'px', 'helper' => __('Set the box width. Set <i>0</i> for a full width box.', 'pk_translate')),
|
||||
'message_box_type' => array('title' => __('Message type:', 'pk_translate'), 'type' => 'select', 'values' => array('info', 'note', 'success', 'error', 'warning', 'important', 'help'), 'labels' => array(__('Info', 'pk_translate'), __('Note', 'pk_translate'), __('Success', 'pk_translate'), __('Error', 'pk_translate'), __('Warning', 'pk_translate'), __('Important', 'pk_translate'), __('Help', 'pk_translate')), 'helper' => __('Select the message type for the current box. Each message type will output a specific box style.', 'pk_translate')),
|
||||
'message_box_content' => array('title' => __('Content:', 'pk_translate'), 'type' => 'text_area', 'rows' => '6', 'helper' => __('Type here the box content. You can leave this field empty and type the content directly in the main editor.', 'pk_translate'))
|
||||
|
||||
);
|
||||
$pk_shortcodes['values'][] = array(
|
||||
|
||||
'message_box_width' => '0',
|
||||
'message_box_type' => 'info',
|
||||
'message_box_content' => ''
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
* Buttons
|
||||
*/
|
||||
|
||||
$pk_shortcodes['type'][] = 'buttons';
|
||||
$pk_shortcodes['options'][] = array(
|
||||
|
||||
'buttons_label' => array('title' => __('Label:', 'pk_translate'), 'type' => 'text', 'helper' => __('Type here the button label.', 'pk_translate')),
|
||||
'buttons_size' => array('title' => __('Size:', 'pk_translate'), 'type' => 'select', 'values' => array('mini', 'small', 'medium', 'big'), 'labels' => array(__('Mini', 'pk_translate'), __('Small', 'pk_translate'), __('Medium', 'pk_translate'), __('Big', 'pk_translate')), 'helper' => __('Select a button size.', 'pk_translate')),
|
||||
'buttons_color' => array('title' => __('Color:', 'pk_translate'), 'type' => 'select', 'values' => array('white', 'grey', 'black', 'lime', 'orange', 'yellow', 'green', 'blue', 'purple', 'red'), 'labels' => array(__('White', 'pk_translate'), __('Grey', 'pk_translate'), __('Black', 'pk_translate'), __('Lime', 'pk_translate'), __('Orange', 'pk_translate'), __('Yellow', 'pk_translate'), __('Green', 'pk_translate'), __('Blue', 'pk_translate'), __('Purple', 'pk_translate'), __('Red', 'pk_translate')), 'helper' => __('Select the button color.', 'pk_translate')),
|
||||
'buttons_icon' => array('title' => __('Icon:', 'pk_translate'), 'type' => 'select', 'values' => array('', 'arrow', 'download', 'home', 'mail', 'mini_arrow', 'zoom'), 'labels' => array(__('No Icon', 'pk_translate'), __('Arrow Icon', 'pk_translate'), __('Download Icon', 'pk_translate'), __('Home Icon', 'pk_translate'), __('Mail Icon', 'pk_translate'), __('Mini Arrow Icon', 'pk_translate'), __('Zoom Icon', 'pk_translate')), 'helper' => __('Select the icon type to add to the button.', 'pk_translate')),
|
||||
'buttons_link' => array('title' => __('Link:', 'pk_translate'), 'type' => 'text', 'helper' => __('Type here the link to open by clicking on this button.', 'pk_translate')),
|
||||
'buttons_link_target' => array('title' => __('Link target:', 'pk_translate'), 'type' => 'select', 'values' => array('_self', '_blank'), 'labels' => array(__('Self', 'pk_translate'), __('Blank', 'pk_translate')), 'helper' => __('Select the window target for the link. Select <i>Self</i> to open the link in the current browser window, select <i>Blank</i> to open the link in a new browser window.', 'pk_translate')),
|
||||
'buttons_title' => array('title' => __('Link tag title:', 'pk_translate'), 'type' => 'text', 'helper' => __('Type here the title attribute for the button link. The title will appear on roll over.', 'pk_translate'))
|
||||
|
||||
);
|
||||
$pk_shortcodes['values'][] = array(
|
||||
|
||||
'buttons_label' => '',
|
||||
'buttons_size' => 'small',
|
||||
'buttons_color' => '',
|
||||
'buttons_icon' => '',
|
||||
'buttons_link' => '#',
|
||||
'buttons_link_target' => '_self',
|
||||
'buttons_title' => ''
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
* Columns
|
||||
*/
|
||||
|
||||
$pk_shortcodes['type'][] = 'columns';
|
||||
$pk_shortcodes['options'][] = array(
|
||||
|
||||
'columns_size' => array('title' => __('Column size:', 'pk_translate'), 'type' => 'select', 'values' => array('pk_full_width', 'pk_one_half', 'pk_one_third', 'pk_one_fourth', 'pk_one_fifth', 'pk_one_sixth', 'pk_two_third', 'pk_three_fourth', 'pk_two_fifth', 'pk_three_fifth', 'pk_four_fifth', 'pk_five_sixth', 'pk_one_half pk_last', 'pk_one_third pk_last', 'pk_one_fourth pk_last', 'pk_one_fifth pk_last', 'pk_one_sixth pk_last', 'pk_two_third pk_last', 'pk_three_fourth pk_last', 'pk_two_fifth pk_last', 'pk_three_fifth pk_last', 'pk_four_fifth pk_last', 'pk_five_sixth pk_last'), 'labels' => array('Column Full Width', 'Column 1/2', 'Column 1/3', 'Column 1/4', 'Column 1/5', 'Column 1/6', 'Column 2/3', 'Column 3/4', 'Column 2/5', 'Column 3/5', 'Column 4/5', 'Column 5/6', 'Column 1/2 Last', 'Column 1/3 Last', 'Column 1/4 Last', 'Column 1/5 Last', 'Column 1/6 Last', 'Column 2/3 Last', 'Column 3/4 Last', 'Column 2/5 Last', 'Column 3/5 Last', 'Column 4/5 Last', 'Column 5/6 Last'), 'helper' => __('Select the column size that you want to generate. Remember that the last column of each row must be a <i>Last</i> column.', 'pk_translate')),
|
||||
'columns_content' => array('title' => __('Content:', 'pk_translate'), 'type' => 'text_area', 'rows' => '10', 'helper' => __('Enter here the column content. You can leave this field empty and type the content directly in the main editor.', 'pk_translate'))
|
||||
|
||||
);
|
||||
$pk_shortcodes['values'][] = array(
|
||||
|
||||
'columns_size' => '',
|
||||
'columns_content' => '<p>Column HTML contents go here or leave this field empty and put your contents directly in the main editor.</p>'
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
* Dividers
|
||||
*/
|
||||
|
||||
$pk_shortcodes['type'][] = 'dividers';
|
||||
$pk_shortcodes['options'][] = array(
|
||||
|
||||
'dividers_type' => array('title' => __('Divider type:', 'pk_translate'), 'type' => 'select', 'values' => array('pk_divider', 'pk_divider_top', 'pk_clear_both', 'pk_empty_space'), 'labels' => array('Divider', 'Dvider Top', 'Clear Both', 'Empty Space'), 'helper' => __('Select the divider type that you want to use.', 'pk_translate')),
|
||||
'dividers_height' => array('title' => __('Height:', 'pk_translate'), 'type' => 'slider', 'min' => '0', 'max' => '200', 'uom' => 'px', 'helper' => __('The height attribute is used by the <i>Empty Space</i> divider only.', 'pk_translate'))
|
||||
|
||||
);
|
||||
$pk_shortcodes['values'][] = array(
|
||||
|
||||
'dividers_type' => '',
|
||||
'dividers_height' => '30'
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
* Google Maps
|
||||
*/
|
||||
|
||||
$pk_shortcodes['type'][] = 'google_maps';
|
||||
$pk_shortcodes['options'][] = array(
|
||||
|
||||
'google_maps_map_url' => array('title' => __('Map URL:', 'pk_translate'), 'type' => 'text', 'helper' => __('Type here the URL of the map that you want to load.', 'pk_translate')),
|
||||
'google_maps_map_height' => array('title' => __('Map height:', 'pk_translate'), 'type' => 'slider', 'min' => '0', 'max' => '1000', 'uom' => 'px', 'helper' => __('Set the height of the map.', 'pk_translate')),
|
||||
|
||||
|
||||
);
|
||||
$pk_shortcodes['values'][] = array(
|
||||
|
||||
'google_maps_map_url' => '',
|
||||
'google_maps_map_height' => '400'
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
* Pricing Tables
|
||||
*/
|
||||
|
||||
$pk_shortcodes['type'][] = 'pricing_tables';
|
||||
$pk_shortcodes['options'][] = array(
|
||||
|
||||
'pricing_tables_layout_columns' => array('title' => __('Table layout (columns):', 'pk_translate'), 'type' => 'slider', 'min' => '2', 'max' => '5', 'uom' => 'columns', 'helper' => __('Set the number of columns.', 'pk_translate')),
|
||||
'pricing_tables_layout_rows' => array('title' => __('Table layout (rows):', 'pk_translate'), 'type' => 'slider', 'min' => '1', 'max' => '100', 'uom' => 'rows', 'helper' => __('Set the number of rows for each column.', 'pk_translate')),
|
||||
'pricing_tables_highlight' => array('title' => __('Highlighted column:', 'pk_translate'), 'type' => 'slider', 'min' => '0', 'max' => '5', 'uom' => '', 'helper' => __('Select the column that you want to highlight. Set 0 if you don\'t want to highlight any column.', 'pk_translate')),
|
||||
'pricing_tables_highlight_color' => array('title' => __('Highlight color:', 'pk_translate'), 'type' => 'select', 'values' => array(' pk_highlight_white', ' pk_highlight_grey', ' pk_highlight_black', ' pk_highlight_lime', ' pk_highlight_orange', ' pk_highlight_yellow', ' pk_highlight_green', ' pk_highlight_blue', ' pk_highlight_purple', ' pk_highlight_red'), 'labels' => array(__('White', 'pk_translate'), __('Grey', 'pk_translate'), __('Black', 'pk_translate'), __('Lime', 'pk_translate'), __('Orange', 'pk_translate'), __('Yellow', 'pk_translate'), __('Green', 'pk_translate'), __('Blue', 'pk_translate'), __('Purple', 'pk_translate'), __('Red', 'pk_translate')), 'helper' => __('Select the drop cap color.', 'pk_translate'))
|
||||
|
||||
);
|
||||
$pk_shortcodes['values'][] = array(
|
||||
|
||||
'pricing_tables_layout_columns' => '2',
|
||||
'pricing_tables_layout_rows' => '5',
|
||||
'pricing_tables_highlight' => '0',
|
||||
'pricing_tables_highlight_color' => ''
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
* Tabs
|
||||
*/
|
||||
|
||||
$pk_shortcodes['type'][] = 'tabs';
|
||||
$pk_shortcodes['options'][] = array(
|
||||
|
||||
'tabs_title' => array('title' => __('Title:', 'pk_translate'), 'type' => 'text', 'helper' => __('Type here a general title for the tabs.', 'pk_translate')),
|
||||
'tabs_width' => array('title' => __('Width:', 'pk_translate'), 'type' => 'slider', 'min' => '0', 'max' => '940', 'uom' => 'px', 'helper' => __('Set the tabs width. Set <i>0</i> for full width tabs.', 'pk_translate')),
|
||||
'tabs_number' => array('title' => __('Number of tabs:', 'pk_translate'), 'type' => 'slider', 'min' => '1', 'max' => '30', 'uom' => __('tabs', 'pk_translate'), 'helper' => __('Select the number of tabs that you need. You will create the tabs contents directly in the main editor.', 'pk_translate'))
|
||||
|
||||
);
|
||||
$pk_shortcodes['values'][] = array(
|
||||
'tabs_title' => '',
|
||||
'tabs_width' => '0',
|
||||
'tabs_number' => '3'
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
* Toggles
|
||||
*/
|
||||
|
||||
$pk_shortcodes['type'][] = 'toggles';
|
||||
$pk_shortcodes['options'][] = array(
|
||||
|
||||
'toggles_width' => array('title' => __('Width:', 'pk_translate'), 'type' => 'slider', 'min' => '0', 'max' => '940', 'uom' => 'px', 'helper' => __('Set the toggles width. Set <i>0</i> for full width toggles.', 'pk_translate')),
|
||||
'toggles_accordion' => array('title' => __('Accordion style:', 'pk_translate'), 'type' => 'select', 'values' => array(' pk_accordion', ''), 'labels' => array(__('Yes', 'pk_translate'), __('No', 'pk_translate')), 'helper' => __('Select <i>Yes</i> to have the toggles working like an accordion.', 'pk_translate')),
|
||||
'toggles_number' => array('title' => __('Number of toggles:', 'pk_translate'), 'type' => 'slider', 'min' => '1', 'max' => '30', 'uom' => __('toggles', 'pk_translate'), 'helper' => __('Select the number of toggles that you need. You will create the toggles contents directly in the main editor.', 'pk_translate'))
|
||||
|
||||
);
|
||||
$pk_shortcodes['values'][] = array(
|
||||
|
||||
'toggles_width' => '0',
|
||||
'toggles_accordion' => '',
|
||||
'toggles_number' => '3'
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
* Typography (heading underline)
|
||||
*/
|
||||
|
||||
$pk_shortcodes['type'][] = 'typography_hu';
|
||||
$pk_shortcodes['options'][] = array(
|
||||
|
||||
'typography_hu_size' => array('title' => __('Heading size:', 'pk_translate'), 'type' => 'select', 'values' => array('h1', 'h2', 'h3', 'h4', 'h5', 'h6'), 'labels' => array('h1', 'h2', 'h3', 'h4', 'h5', 'h6'), 'helper' => __('Select the heading size.', 'pk_translate')),
|
||||
'typography_hu_heading' => array('title' => __('Heading text:', 'pk_translate'), 'type' => 'text_area', 'rows' => '3', 'helper' => __('Type here the heading text.', 'pk_translate'))
|
||||
|
||||
);
|
||||
$pk_shortcodes['values'][] = array(
|
||||
|
||||
'typography_hu_size' => 'h1',
|
||||
'typography_hu_heading' => 'This is an heading!'
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
* Typography (heading background)
|
||||
*/
|
||||
|
||||
$pk_shortcodes['type'][] = 'typography_hb';
|
||||
$pk_shortcodes['options'][] = array(
|
||||
|
||||
'typography_hb_color' => array('title' => __('Text color:', 'pk_translate'), 'type' => 'color', 'helper' => __('Click on the color field to pick a new color.', 'pk_translate')),
|
||||
'typography_hb_background_color' => array('title' => __('Background color:', 'pk_translate'), 'type' => 'color', 'helper' => __('Click on the color field to pick a new color.', 'pk_translate')),
|
||||
'typography_hb_rounded' => array('title' => __('Rounded background:', 'pk_translate'), 'type' => 'select', 'values' => array(' pk_rounded', ''), 'labels' => array(__('Yes', 'pk_translate'), __('No', 'pk_translate')), 'helper' => __('Select <i>Yes</i> for rounded background.', 'pk_translate')),
|
||||
'typography_hb_size' => array('title' => __('Heading size:', 'pk_translate'), 'type' => 'select', 'values' => array('h1', 'h2', 'h3', 'h4', 'h5', 'h6'), 'labels' => array('h1', 'h2', 'h3', 'h4', 'h5', 'h6'), 'helper' => __('Select the heading size.', 'pk_translate')),
|
||||
'typography_hb_heading' => array('title' => __('Heading text:', 'pk_translate'), 'type' => 'text_area', 'rows' => '3', 'helper' => __('Type here the heading text.', 'pk_translate'))
|
||||
|
||||
);
|
||||
$pk_shortcodes['values'][] = array(
|
||||
|
||||
'typography_hb_color' => '',
|
||||
'typography_hb_background_color' => '',
|
||||
'typography_hb_rounded' => ' pk_rounded',
|
||||
'typography_hb_size' => 'h1',
|
||||
'typography_hb_heading' => 'This is an heading!'
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
* Typography (quote)
|
||||
*/
|
||||
|
||||
$pk_shortcodes['type'][] = 'typography_quote';
|
||||
$pk_shortcodes['options'][] = array(
|
||||
|
||||
'typography_quote_width' => array('title' => __('Width:', 'pk_translate'), 'type' => 'slider', 'min' => '0', 'max' => '940', 'uom' => 'px', 'helper' => __('Set the quote width. Set <i>0</i> for full width quote.', 'pk_translate')),
|
||||
'typography_quote_cite' => array('title' => __('Cite:', 'pk_translate'), 'type' => 'text_area', 'rows' => '3', 'helper' => __('Type here the citation text.', 'pk_translate')),
|
||||
'typography_quote_quote' => array('title' => __('Quote:', 'pk_translate'), 'type' => 'text_area', 'rows' => '6', 'helper' => __('Type here the quote content. You can leave this field empty and type the content directly in the main editor.', 'pk_translate'))
|
||||
|
||||
);
|
||||
$pk_shortcodes['values'][] = array(
|
||||
|
||||
'typography_quote_width' => '0',
|
||||
'typography_quote_cite' => '',
|
||||
'typography_quote_quote' => ''
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
* Typography (lists)
|
||||
*/
|
||||
|
||||
$pk_shortcodes['type'][] = 'typography_lists';
|
||||
$pk_shortcodes['options'][] = array(
|
||||
|
||||
'typography_lists_style' => array('title' => __('Style:', 'pk_translate'), 'type' => 'select', 'values' => array('pk_clear_list', 'pk_arrow_list', 'pk_check_list'), 'labels' => array(__('Clear List', 'pk_translate'), __('Arrow List', 'pk_translate'), __('Check List', 'pk_translate')), 'helper' => __('Select a list style.', 'pk_translate')),
|
||||
'typography_lists_list' => array('title' => __('List markup (HTML):', 'pk_translate'), 'type' => 'text_area', 'rows' => '6', 'helper' => __('Type here the HTML markup of the list. You can leave this field empty and type the content directly in the main editor.', 'pk_translate'))
|
||||
|
||||
);
|
||||
$pk_shortcodes['values'][] = array(
|
||||
|
||||
'typography_lists_style' => 'pk_clear_list',
|
||||
'typography_lists_list' => '
|
||||
<ul>
|
||||
<li>Your list item</li>
|
||||
<li>Your list item</li>
|
||||
<li>Your list item</li>
|
||||
</ul>'
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
* Typography (highlight)
|
||||
*/
|
||||
|
||||
$pk_shortcodes['type'][] = 'typography_hl';
|
||||
$pk_shortcodes['options'][] = array(
|
||||
|
||||
'typography_hl_color' => array('title' => __('Text color:', 'pk_translate'), 'type' => 'color', 'helper' => __('Click on the color field to pick a new color.', 'pk_translate')),
|
||||
'typography_hl_background_color' => array('title' => __('Background color:', 'pk_translate'), 'type' => 'color', 'helper' => __('Click on the color field to pick a new color.', 'pk_translate')),
|
||||
'typography_hl_rounded' => array('title' => __('Rounded background:', 'pk_translate'), 'type' => 'select', 'values' => array(' pk_rounded', ''), 'labels' => array(__('Yes', 'pk_translate'), __('No', 'pk_translate')), 'helper' => __('Select <i>Yes</i> for rounded background.', 'pk_translate')),
|
||||
'typography_hl_content' => array('title' => __('Content to highlight:', 'pk_translate'), 'type' => 'text_area', 'rows' => '3', 'helper' => __('Type here the text to highlight.', 'pk_translate'))
|
||||
|
||||
);
|
||||
$pk_shortcodes['values'][] = array(
|
||||
|
||||
'typography_hl_color' => '',
|
||||
'typography_hl_background_color' => '',
|
||||
'typography_hl_rounded' => ' pk_rounded',
|
||||
'typography_hl_content' => ''
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
* Typography (drop caps)
|
||||
*/
|
||||
|
||||
$pk_shortcodes['type'][] = 'typography_dc';
|
||||
$pk_shortcodes['options'][] = array(
|
||||
|
||||
'typography_dc_type' => array('title' => __('Type:', 'pk_translate'), 'type' => 'select', 'values' => array('pk_drop_cap_1', 'pk_drop_cap_2'), 'labels' => array(__('Only text', 'pk_translate'), __('Text with background color', 'pk_translate')), 'helper' => __('Select the drop caps type.', 'pk_translate')),
|
||||
'typography_dc_color' => array('title' => __('Background color:', 'pk_translate'), 'type' => 'select', 'values' => array(' pk_drop_cap_white', ' pk_drop_cap_grey', ' pk_drop_cap_black', ' pk_drop_cap_lime', ' pk_drop_cap_orange', ' pk_drop_cap_yellow', ' pk_drop_cap_green', ' pk_drop_cap_blue', ' pk_drop_cap_purple', ' pk_drop_cap_red'), 'labels' => array(__('White', 'pk_translate'), __('Grey', 'pk_translate'), __('Black', 'pk_translate'), __('Lime', 'pk_translate'), __('Orange', 'pk_translate'), __('Yellow', 'pk_translate'), __('Green', 'pk_translate'), __('Blue', 'pk_translate'), __('Purple', 'pk_translate'), __('Red', 'pk_translate')), 'helper' => __('Select the drop cap color.', 'pk_translate')),
|
||||
'typography_dc_text' => array('title' => __('Text:', 'pk_translate'), 'type' => 'text', 'helper' => __('Type here the character to capitilize.', 'pk_translate'))
|
||||
|
||||
);
|
||||
$pk_shortcodes['values'][] = array(
|
||||
|
||||
'typography_dc_type' => 'pk_drop_cap_1',
|
||||
'typography_dc_color' => '',
|
||||
'typography_dc_text' => ''
|
||||
|
||||
);
|
||||
|
||||
if (class_exists('pk_shortcodes_manager_generator') && !isset($pk_shortcodes_manager_generator_instance)) {
|
||||
|
||||
$pk_shortcodes_manager_generator_instance = new pk_shortcodes_manager_generator($pk_shortcodes, 'pk_sc_');
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,694 @@
|
||||
<?php
|
||||
|
||||
global $pk_shortcodes_manager_instance;
|
||||
|
||||
if (!class_exists('pk_shortcodes_manager')) {
|
||||
|
||||
class pk_shortcodes_manager {
|
||||
|
||||
function pk_shortcodes_manager() {
|
||||
|
||||
}
|
||||
|
||||
function pk_add_title($title = '', $color = true, $special_color = false) {
|
||||
|
||||
$class = ($color == true) ? 'pk_admin_tr_color' : 'pk_admin_tr';
|
||||
$class = ($special_color == true) ? 'pk_admin_tr_special' : $class;
|
||||
|
||||
echo '
|
||||
<tr class="'.$class.'">
|
||||
<th scope="row" class="pk_admin_th">
|
||||
<h4>'.$title.'</h4>
|
||||
</th>';
|
||||
|
||||
}
|
||||
|
||||
function pk_add_input_text_field($name = '', $value = '', $helper = '') {
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">
|
||||
<p><input class="pk_admin_input_text_field" type="text" name="'.$name.'" value="'.$value.'" /></p>
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
}
|
||||
|
||||
function pk_add_input_text_area($name = '', $value = '', $rows = '6', $helper = '') {
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">
|
||||
<p><textarea rows="'.$rows.'" cols="60" class="pk_admin_input_text_area" name="'.$name.'">'.$value.'</textarea></p>
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
}
|
||||
|
||||
function pk_add_input_radio_group($name = '', $values = array(), $labels = array(), $checked = '', $helper = '') {
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">';
|
||||
|
||||
for ($i = 0; $i < count($values); $i++) {
|
||||
|
||||
if ($values[$i] == $checked) {
|
||||
|
||||
$checked_string = ' checked="checked"';
|
||||
|
||||
} else {
|
||||
|
||||
$checked_string = '';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
<p><input id="'.$name.'_'.$i.'" class="pk_admin_radio_checkbox" type="radio" name="'.$name.'" value="'.$values[$i].'"'.$checked_string.' /><label for="'.$name.'_'.$i.'" class="pk_admin_radio_label"> '.$labels[$i].'</label></p>';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
}
|
||||
|
||||
function pk_add_input_select($name = '', $select_box = false, $values = array(), $labels = array(), $selected = '', $helper = '') {
|
||||
|
||||
($select_box == true) ? $class = 'pk_admin_input_select_box' : $class = 'pk_admin_input_select';
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">
|
||||
<p>
|
||||
<select class="'.$class.'" name="'.$name.'">';
|
||||
|
||||
for ($i = 0; $i < count($values); $i++) {
|
||||
|
||||
if ($values[$i] == $selected) {
|
||||
|
||||
$selected_string = ' selected="selected"';
|
||||
|
||||
} else {
|
||||
|
||||
$selected_string = '';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
<option value="'.$values[$i].'"'.$selected_string.'>'.$labels[$i].'</option>';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
</select>
|
||||
</p>
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
}
|
||||
|
||||
function pk_add_input_color($name = '', $value = '', $helper = '') {
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">
|
||||
<p><input class="pk_admin_input_color color {hash:true, caps:false, pickerPosition:\'right\', pickerMode:\'HSV\', pickerFace:15, pickerFaceColor:\'#eeeeee\', pickerBorderColor:\'#d6d6d6\', pickerInsetColor:\'#f3f3f3\'}" type="text" name="'.$name.'" value="'.$value.'" /></p>
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
}
|
||||
|
||||
function pk_add_input_slider($name = '', $value = '0', $min = '0', $max = '100', $uom = 'px', $helper = '') {
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">
|
||||
<div class="pk_admin_slider_div">
|
||||
<p><input class="pk_admin_input_slider" type="text" name="'.$name.'" value="'.$value.'" min="'.$min.'" max="'.$max.'"'.(($max == 1) ? ' step="0.01"' : '').' /> '.$uom.'</p>
|
||||
</div>
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
}
|
||||
|
||||
function pk_add_input_category($name = '', $value = '', $taxonomy = 'category', $helper = '') {
|
||||
|
||||
$categories = get_categories(array('hide_empty' => 1, 'hierarchical' => false, 'taxonomy' => trim($taxonomy)));
|
||||
|
||||
if (!$categories) {
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">
|
||||
<p><strong>'.__('No categories available', 'pk_translate').'</strong></p>
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
$values = array('');
|
||||
$labels = array(__('-- Select --', 'pk_translate'));
|
||||
|
||||
foreach ($categories as $category) {
|
||||
|
||||
array_push($values, $category -> term_id);
|
||||
array_push($labels, $category -> name);
|
||||
|
||||
}
|
||||
|
||||
$this -> pk_add_input_select($name, false, $values, $labels, $value, $helper);
|
||||
|
||||
}
|
||||
|
||||
function pk_add_input_categories($name = '', $value = '', $taxonomy = 'category', $helper = '') {
|
||||
|
||||
$categories = get_categories(array('hide_empty' => 1, 'hierarchical' => false, 'taxonomy' => trim($taxonomy)));
|
||||
|
||||
if (!$categories) {
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">
|
||||
<p><strong>'.__('No categories available', 'pk_translate').'</strong></p>
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
$selected_categories = explode(',', $value);
|
||||
|
||||
$total = count($categories);
|
||||
|
||||
if ($total <= 12) {
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">
|
||||
<input class="pk_admin_multiple_field" type="hidden" name="'.$name.'" value="'.$value.'" />
|
||||
<div class="pk_admin_multiple_checkbox_div_wrapper">';
|
||||
|
||||
$checkboxes_count = 0;
|
||||
|
||||
foreach ($categories as $category) {
|
||||
|
||||
$checked = '';
|
||||
|
||||
if (in_array($category -> term_id, $selected_categories)) {
|
||||
|
||||
$checked = ' checked="checked"';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
<div class="pk_admin_multiple_checkbox_div"><input data-main="'.$name.'" id="'.$name.'_checkbox_'.$checkboxes_count.'" class="pk_admin_multiple_checkbox pk_admin_radio_checkbox" type="checkbox" value="'.$category -> term_id.'"'.$checked.' /><label for="'.$name.'_checkbox_'.$checkboxes_count.'" class="pk_admin_multiple_checkbox_label">'.$category -> name.'</label></div>';
|
||||
|
||||
$checkboxes_count++;
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
</div>
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
} else {
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">
|
||||
<input class="pk_admin_multiple_field" type="hidden" name="'.$name.'" value="'.$value.'" />
|
||||
<select data-main="'.$name.'" class="pk_admin_input_select_multiple" multiple="multiple">';
|
||||
|
||||
foreach ($categories as $category) {
|
||||
|
||||
if (in_array($category -> term_id, $selected_categories)) {
|
||||
|
||||
$selected_string = ' selected="selected"';
|
||||
|
||||
} else {
|
||||
|
||||
$selected_string = '';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
<option value="'.$category -> term_id.'"'.$selected_string.'>'.$category -> name.' ('.$category -> category_count.')</option>';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
</select>
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_add_input_page($name = '', $value = '', $post_type = 'page', $helper = '') {
|
||||
|
||||
$pages = get_pages(array('hierarchical' => false, 'post_type' => trim($post_type)));
|
||||
|
||||
if (!$pages) {
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">
|
||||
<p><strong>'.__('No pages available', 'pk_translate').'</strong></p>
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
$values = array('');
|
||||
$labels = array(__('-- Select --', 'pk_translate'));
|
||||
|
||||
foreach ($pages as $page) {
|
||||
|
||||
array_push($values, $page -> ID);
|
||||
array_push($labels, $page -> post_title);
|
||||
|
||||
}
|
||||
|
||||
$this -> pk_add_input_select($name, false, $values, $labels, $value, $helper);
|
||||
|
||||
}
|
||||
|
||||
function pk_add_input_pages($name = '', $value = '', $post_type = 'page', $helper = '') {
|
||||
|
||||
$pages = get_pages(array('hierarchical' => false, 'post_type' => trim($post_type)));
|
||||
|
||||
if (!$pages) {
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">
|
||||
<p><strong>'.__('No pages available', 'pk_translate').'</strong></p>
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
$selected_pages = explode(',', $value);
|
||||
|
||||
$total = count($pages);
|
||||
|
||||
if ($total <= 12) {
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">
|
||||
<input class="pk_admin_multiple_field" type="hidden" name="'.$name.'" value="'.$value.'" />
|
||||
<div class="pk_admin_multiple_checkbox_div_wrapper">';
|
||||
|
||||
$checkboxes_count = 0;
|
||||
|
||||
foreach ($pages as $page) {
|
||||
|
||||
$checked = '';
|
||||
|
||||
if (in_array($page -> ID, $selected_pages)) {
|
||||
|
||||
$checked = ' checked="checked"';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
<div class="pk_admin_multiple_checkbox_div"><input data-main="'.$name.'" id="'.$name.'_checkbox_'.$checkboxes_count.'" class="pk_admin_multiple_checkbox pk_admin_radio_checkbox" type="checkbox" value="'.$page -> ID.'"'.$checked.' /><label for="'.$name.'_checkbox_'.$checkboxes_count.'" class="pk_admin_multiple_checkbox_label">'.$page -> post_title.'</label></div>';
|
||||
|
||||
$checkboxes_count++;
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
</div>
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
} else {
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">
|
||||
<input class="pk_admin_multiple_field" type="hidden" name="'.$name.'" value="'.$value.'" />
|
||||
<select data-main="'.$name.'" class="pk_admin_input_select_multiple" multiple="multiple">';
|
||||
|
||||
foreach ($pages as $page) {
|
||||
|
||||
if (in_array($page -> ID, $selected_pages)) {
|
||||
|
||||
$selected_string = ' selected="selected"';
|
||||
|
||||
} else {
|
||||
|
||||
$selected_string = '';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
<option value="'.$page -> ID.'"'.$selected_string.'>'.$page -> post_title.'</option>';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
</select>
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_add_input_post($name = '', $value = '', $post_type = 'post', $helper = '') {
|
||||
|
||||
$posts = get_posts(array('post_type' => trim($post_type), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC'));
|
||||
|
||||
if (!$posts) {
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">
|
||||
<p><strong>'.__('No posts available', 'pk_translate').'</strong></p>
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
$values = array('');
|
||||
$labels = array(__('-- Select --', 'pk_translate'));
|
||||
|
||||
foreach ($posts as $post) {
|
||||
|
||||
array_push($values, $post -> ID);
|
||||
array_push($labels, $post -> post_title);
|
||||
|
||||
}
|
||||
|
||||
$this -> pk_add_input_select($name, false, $values, $labels, $value, $helper);
|
||||
|
||||
}
|
||||
|
||||
function pk_add_input_posts($name = '', $value = '', $post_type = 'post', $helper = '') {
|
||||
|
||||
$posts = get_posts(array('post_type' => trim($post_type), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC'));
|
||||
|
||||
if (!$posts) {
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">
|
||||
<p><strong>'.__('No posts available', 'pk_translate').'</strong></p>
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
$selected_posts = explode(',', $value);
|
||||
|
||||
$total = count($posts);
|
||||
|
||||
if ($total <= 12) {
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">
|
||||
<input class="pk_admin_multiple_field" type="hidden" name="'.$name.'" value="'.$value.'" />
|
||||
<div class="pk_admin_multiple_checkbox_div_wrapper">';
|
||||
|
||||
$checkboxes_count = 0;
|
||||
|
||||
foreach ($posts as $post) {
|
||||
|
||||
$checked = '';
|
||||
|
||||
if (in_array($post -> ID, $selected_posts)) {
|
||||
|
||||
$checked = ' checked="checked"';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
<div class="pk_admin_multiple_checkbox_div"><input data-main="'.$name.'" id="'.$name.'_checkbox_'.$checkboxes_count.'" class="pk_admin_multiple_checkbox pk_admin_radio_checkbox" type="checkbox" value="'.$post -> ID.'"'.$checked.' /><label for="'.$name.'_checkbox_'.$checkboxes_count.'" class="pk_admin_multiple_checkbox_label">'.$post -> post_title.'</label></div>';
|
||||
|
||||
$checkboxes_count++;
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
</div>
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
} else {
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">
|
||||
<input class="pk_admin_multiple_field" type="hidden" name="'.$name.'" value="'.$value.'" />
|
||||
<select data-main="'.$name.'" class="pk_admin_input_select_multiple" multiple="multiple">';
|
||||
|
||||
foreach ($posts as $post) {
|
||||
|
||||
if (in_array($post -> ID, $selected_posts)) {
|
||||
|
||||
$selected_string = ' selected="selected"';
|
||||
|
||||
} else {
|
||||
|
||||
$selected_string = '';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
<option value="'.$post -> ID.'"'.$selected_string.'>'.$post -> post_title.'</option>';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
</select>
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_add_input_tag($name = '', $value = '', $helper = '') {
|
||||
|
||||
$tags = get_tags(array('hide_empty' => false));
|
||||
|
||||
if (!$tags) {
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">
|
||||
<p><strong>'.__('No tags available', 'pk_translate').'</strong></p>
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
$values = array('');
|
||||
$labels = array(__('-- Select --', 'pk_translate'));
|
||||
|
||||
foreach ($tags as $tag) {
|
||||
|
||||
array_push($values, $tag -> term_id);
|
||||
array_push($labels, $tag -> name);
|
||||
|
||||
}
|
||||
|
||||
$this -> pk_add_input_select($name, false, $values, $labels, $value, $helper);
|
||||
|
||||
}
|
||||
|
||||
function pk_add_input_tags($name = '', $value = '', $helper = '') {
|
||||
|
||||
$tags = get_tags(array('hide_empty' => false));
|
||||
|
||||
if (!$tags) {
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">
|
||||
<p><strong>'.__('No tags available', 'pk_translate').'</strong></p>
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
$selected_tags = explode(',', $value);
|
||||
|
||||
$total = count($tags);
|
||||
|
||||
if ($total <= 12) {
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">
|
||||
<input class="pk_admin_multiple_field" type="hidden" name="'.$name.'" value="'.$value.'" />
|
||||
<div class="pk_admin_multiple_checkbox_div_wrapper">';
|
||||
|
||||
$checkboxes_count = 0;
|
||||
|
||||
foreach ($tags as $tag) {
|
||||
|
||||
$checked = '';
|
||||
|
||||
if (in_array($tag -> term_id, $selected_tags)) {
|
||||
|
||||
$checked = ' checked="checked"';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
<div class="pk_admin_multiple_checkbox_div"><input data-main="'.$name.'" id="'.$name.'_checkbox_'.$checkboxes_count.'" class="pk_admin_multiple_checkbox pk_admin_radio_checkbox" type="checkbox" value="'.$tag -> term_id.'"'.$checked.' /><label for="'.$name.'_checkbox_'.$checkboxes_count.'" class="pk_admin_multiple_checkbox_label">'.$tag -> name.'</label></div>';
|
||||
|
||||
$checkboxes_count++;
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
</div>
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
} else {
|
||||
|
||||
echo '
|
||||
<td class="pk_admin_td">
|
||||
<input class="pk_admin_multiple_field" type="hidden" name="'.$name.'" value="'.$value.'" />
|
||||
<select data-main="'.$name.'" class="pk_admin_input_select_multiple" multiple="multiple">';
|
||||
|
||||
foreach ($tags as $tag) {
|
||||
|
||||
if (in_array($tag -> term_id, $selected_tags)) {
|
||||
|
||||
$selected_string = ' selected="selected"';
|
||||
|
||||
} else {
|
||||
|
||||
$selected_string = '';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
<option value="'.$tag -> term_id.'"'.$selected_string.'>'.$tag -> name.'</option>';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
</select>
|
||||
<p class="pk_admin_helper"><strong class="pk_admin_helper_strong">? </strong>'.$helper.'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_open_table($id = '') {
|
||||
|
||||
echo '
|
||||
<table cellspacing="0" id="pk_sc_table_'.$id.'" class="widefat">
|
||||
<tbody>';
|
||||
|
||||
}
|
||||
|
||||
function pk_close_table() {
|
||||
|
||||
echo '
|
||||
</tbody>
|
||||
</table>';
|
||||
|
||||
}
|
||||
|
||||
function pk_open_form($options_key = '') {
|
||||
|
||||
echo '
|
||||
<div>
|
||||
<form name="pk_form" method="post" action="">
|
||||
<input type="hidden" name="pk_form_data" value="true" />';
|
||||
|
||||
wp_nonce_field($options_key, md5($options_key));
|
||||
|
||||
}
|
||||
|
||||
function pk_close_form() {
|
||||
|
||||
echo '
|
||||
</form>
|
||||
</div>';
|
||||
|
||||
}
|
||||
|
||||
function pk_open_div() {
|
||||
|
||||
echo '
|
||||
<!-- pk shortcodes manager metabox - start -->
|
||||
<div class="pk_sc_shortcodes_manager">';
|
||||
|
||||
}
|
||||
|
||||
function pk_close_div() {
|
||||
|
||||
echo '
|
||||
</div>
|
||||
<!-- pk shortcodes manager metabox - end -->
|
||||
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
function pk_add_buttons($type) {
|
||||
|
||||
echo '
|
||||
<div class="pk_admin_shortcode_manager_buttons_div">
|
||||
<input id="pk_sc_table_'.$type.'_generate_shortcode_button" class="pk_admin_generate_shortcode_button button-primary" type="button" value="'.__('Generate HTML', 'pk_translate').'" />
|
||||
</div>';
|
||||
|
||||
}
|
||||
|
||||
function pk_open_shortcodes_manager_div($class = '') {
|
||||
|
||||
echo '
|
||||
<div class="'.(($class != 'pk_sc_selector') ? 'pk_admin_sc_div pk_admin_padding_top_div ' : '').$class.'">';
|
||||
|
||||
}
|
||||
|
||||
function pk_close_shortcodes_manager_div() {
|
||||
|
||||
echo '
|
||||
</div>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (class_exists('pk_shortcodes_manager') && !isset($pk_shortcodes_manager_instance)) {
|
||||
|
||||
$pk_shortcodes_manager_instance = new pk_shortcodes_manager();
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,162 @@
|
||||
<?php
|
||||
|
||||
if (!class_exists('pk_shortcodes_manager_generator')) {
|
||||
|
||||
class pk_shortcodes_manager_generator {
|
||||
|
||||
private $options;
|
||||
private $type;
|
||||
private $suffix;
|
||||
|
||||
function pk_shortcodes_manager_generator($options = array(), $suffix = '') {
|
||||
|
||||
$this -> options = $options;
|
||||
$this -> suffix = $suffix;
|
||||
|
||||
add_action('admin_init', array(&$this, 'pk_init_metabox'));
|
||||
|
||||
}
|
||||
|
||||
function pk_init_metabox() {
|
||||
|
||||
if (function_exists('add_meta_box')) {
|
||||
|
||||
add_meta_box(strtolower($this -> suffix.str_replace(' ', '_', $this -> options['title'])), $this -> options['title'], array(&$this, 'pk_create_metabox'), 'page', 'normal', 'high');
|
||||
add_meta_box(strtolower($this -> suffix.str_replace(' ', '_', $this -> options['title'])), $this -> options['title'], array(&$this, 'pk_create_metabox'), 'post', 'normal', 'high');
|
||||
add_meta_box(strtolower($this -> suffix.str_replace(' ', '_', $this -> options['title'])), $this -> options['title'], array(&$this, 'pk_create_metabox'), 'portfolio', 'normal', 'high');
|
||||
add_meta_box(strtolower($this -> suffix.str_replace(' ', '_', $this -> options['title'])), $this -> options['title'], array(&$this, 'pk_create_metabox'), 'product', 'normal', 'high');
|
||||
add_meta_box(strtolower($this -> suffix.str_replace(' ', '_', $this -> options['title'])), $this -> options['title'], array(&$this, 'pk_create_metabox'), 'faq', 'normal', 'high');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_create_metabox() {
|
||||
|
||||
global $pk_shortcodes_manager_instance;
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_open_div();
|
||||
|
||||
for ($i = 0; $i < count($this -> options['options']); $i++) {
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_open_shortcodes_manager_div($this -> suffix.$this -> options['type'][$i]);
|
||||
|
||||
if (count($this -> options['options'][$i]) > 0) {
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_open_table($this -> options['type'][$i]);
|
||||
|
||||
$count = 0;
|
||||
|
||||
foreach ($this -> options['options'][$i] as $k => $v) {
|
||||
|
||||
if ($this -> options['options'][$i][$k]['title'] != '') {
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_add_title($this -> options['options'][$i][$k]['title'], ($count % 2) ? true : false, ($this -> options['options'][$i][$k]['type'] == 'metabox_selector') ? true : false);
|
||||
|
||||
}
|
||||
|
||||
$default = $this -> options['values'][$i][$k];
|
||||
$helper = $this -> options['options'][$i][$k]['helper'];
|
||||
|
||||
switch ($this -> options['options'][$i][$k]['type']) {
|
||||
|
||||
case 'text':
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_add_input_text_field($this -> suffix.$k, $default, $helper);
|
||||
break;
|
||||
|
||||
case 'text_area':
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_add_input_text_area($this -> suffix.$k, $default, $this -> options['options'][$i][$k]['rows'], $helper);
|
||||
break;
|
||||
|
||||
case 'radio_group':
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_add_input_radio_group($this -> suffix.$k, $this -> options['options'][$i][$k]['values'], $this -> options['options'][$i][$k]['labels'], $default, $helper);
|
||||
break;
|
||||
|
||||
case 'select':
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_add_input_select($this -> suffix.$k, false, $this -> options['options'][$i][$k]['values'], $this -> options['options'][$i][$k]['labels'], $default, $helper);
|
||||
break;
|
||||
|
||||
case 'metabox_selector':
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_add_input_select($this -> suffix.$k, true, $this -> options['options'][$i][$k]['values'], $this -> options['options'][$i][$k]['labels'], $default, $helper);
|
||||
break;
|
||||
|
||||
case 'color':
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_add_input_color($this -> suffix.$k, $default, $helper);
|
||||
break;
|
||||
|
||||
case 'slider':
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_add_input_slider($this -> suffix.$k, $default, $this -> options['options'][$i][$k]['min'], $this -> options['options'][$i][$k]['max'], $this -> options['options'][$i][$k]['uom'], $helper);
|
||||
break;
|
||||
|
||||
case 'category':
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_add_input_category($this -> suffix.$k, $default, $this -> options['options'][$i][$k]['taxonomy'], $helper);
|
||||
break;
|
||||
|
||||
case 'categories':
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_add_input_categories($this -> suffix.$k, $default, $this -> options['options'][$i][$k]['taxonomy'], $helper);
|
||||
break;
|
||||
|
||||
case 'page':
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_add_input_page($this -> suffix.$k, $default, $this -> options['options'][$i][$k]['post_type'], $helper);
|
||||
break;
|
||||
|
||||
case 'pages':
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_add_input_pages($this -> suffix.$k, $default, $this -> options['options'][$i][$k]['post_type'], $helper);
|
||||
break;
|
||||
|
||||
case 'post':
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_add_input_post($this -> suffix.$k, $default, $this -> options['options'][$i][$k]['post_type'], $helper);
|
||||
break;
|
||||
|
||||
case 'posts':
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_add_input_posts($this -> suffix.$k, $default, $this -> options['options'][$i][$k]['post_type'], $helper);
|
||||
break;
|
||||
|
||||
case 'tag':
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_add_input_tag($this -> suffix.$k, $default, $helper);
|
||||
break;
|
||||
|
||||
case 'tags':
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_add_input_tags($this -> suffix.$k, $default, $helper);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
$count++;
|
||||
|
||||
}
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_close_table();
|
||||
|
||||
}
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_add_buttons($this -> options['type'][$i]);
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_close_shortcodes_manager_div();
|
||||
|
||||
}
|
||||
|
||||
$pk_shortcodes_manager_instance -> pk_close_div();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
define('PK_THEME_WIDGETS', PK_FRAMEWORK.'/widgets');
|
||||
|
||||
require_once(PK_THEME_WIDGETS.'/pk_widgets_overrides.php');
|
||||
require_once(PK_THEME_WIDGETS.'/pk_widgets_portfolio_categories.php');
|
||||
require_once(PK_THEME_WIDGETS.'/pk_widgets_advertising_125_125.php');
|
||||
require_once(PK_THEME_WIDGETS.'/pk_widgets_advertising_300_250.php');
|
||||
require_once(PK_THEME_WIDGETS.'/pk_widgets_twitter.php');
|
||||
require_once(PK_THEME_WIDGETS.'/pk_widgets_dribbble.php');
|
||||
require_once(PK_THEME_WIDGETS.'/pk_widgets_twitter.php');
|
||||
require_once(PK_THEME_WIDGETS.'/pk_widgets_flickr.php');
|
||||
require_once(PK_THEME_WIDGETS.'/pk_widgets_google_maps.php');
|
||||
require_once(PK_THEME_WIDGETS.'/pk_widgets_sub_navigation.php');
|
||||
require_once(PK_THEME_WIDGETS.'/pk_widgets_featured_posts.php');
|
||||
require_once(PK_THEME_WIDGETS.'/pk_widgets_popular_posts.php');
|
||||
require_once(PK_THEME_WIDGETS.'/pk_widgets_recent_posts.php');
|
||||
require_once(PK_THEME_WIDGETS.'/pk_widgets_related_posts.php');
|
||||
require_once(PK_THEME_WIDGETS.'/pk_widgets_featured_works.php');
|
||||
require_once(PK_THEME_WIDGETS.'/pk_widgets_popular_works.php');
|
||||
require_once(PK_THEME_WIDGETS.'/pk_widgets_recent_works.php');
|
||||
require_once(PK_THEME_WIDGETS.'/pk_widgets_related_works.php');
|
||||
require_once(PK_THEME_WIDGETS.'/pk_widgets_testimonials.php');
|
||||
|
||||
?>
|
@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
class PK_Widget_Advertising_125_125 extends WP_Widget {
|
||||
|
||||
function PK_Widget_Advertising_125_125() {
|
||||
|
||||
$widget_ops = array('classname' => 'widget_advertising_125_125', 'description' => __('Displays your 125 x 125 ads', 'pk_translate'));
|
||||
$this -> WP_Widget('pk-advertising-125-125', __('Advertising 125 x 125', 'pk_translate'), $widget_ops);
|
||||
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
extract($args);
|
||||
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
|
||||
if (empty($title)) $title = false;
|
||||
|
||||
$number = absint($instance['number']);
|
||||
|
||||
$instance_ad_title = array();
|
||||
$instance_ad_image = array();
|
||||
$instance_ad_link = array();
|
||||
|
||||
for ($i = 1; $i <= $number; $i++) {
|
||||
|
||||
$ad_title = 'ad_'.$i.'_title';
|
||||
$instance_ad_title[$i] = isset($instance[$ad_title]) ? $instance[$ad_title] : '';
|
||||
$ad_image = 'ad_'.$i.'_image';
|
||||
$instance_ad_image[$i] = isset($instance[$ad_image]) ? $instance[$ad_image] : '';
|
||||
$ad_link = 'ad_'.$i.'_link';
|
||||
$instance_ad_link[$i] = isset($instance[$ad_link]) ? $instance[$ad_link] : '';
|
||||
|
||||
}
|
||||
|
||||
echo '<!-- pk start pk-advertising-125-125 widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) {
|
||||
|
||||
echo $before_title;
|
||||
echo $title;
|
||||
echo $after_title;
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
<?php for ($i = 1; $i <= $number; $i++) : ?>
|
||||
<a href="<?php echo $instance_ad_link[$i]; ?>" title="<?php echo $instance_ad_title[$i]; ?>"><img src="<?php echo $instance_ad_image[$i]; ?>" alt="<?php echo $instance_ad_title[$i]; ?>" /></a>
|
||||
<?php endfor; ?>
|
||||
<?php
|
||||
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-advertising-125-125 widget -->
|
||||
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
|
||||
$instance = $old_instance;
|
||||
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
$instance['number'] = $new_instance['number'];
|
||||
|
||||
for ($i = 1; $i <= absint($instance['number']); $i++) {
|
||||
|
||||
$instance['ad_'.$i.'_title'] = strip_tags($new_instance['ad_'.$i.'_title']);
|
||||
$instance['ad_'.$i.'_image'] = strip_tags($new_instance['ad_'.$i.'_image']);
|
||||
$instance['ad_'.$i.'_link'] = strip_tags($new_instance['ad_'.$i.'_link']);
|
||||
|
||||
}
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
|
||||
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
||||
$number = isset($instance['number']) ? absint($instance['number']) : 4;
|
||||
|
||||
$instance_ad_title = array();
|
||||
$instance_ad_image = array();
|
||||
$instance_ad_link = array();
|
||||
|
||||
for($i = 1; $i <= $number; $i++) {
|
||||
|
||||
$ad_title = 'ad_'.$i.'_title';
|
||||
$instance_ad_title[$i] = isset($instance[$ad_title]) ? $instance[$ad_title] : '';
|
||||
$ad_image = 'ad_'.$i.'_image';
|
||||
$instance_ad_image[$i] = isset($instance[$ad_image]) ? esc_attr($instance[$ad_image]) : '';
|
||||
$ad_link = 'ad_'.$i.'_link';
|
||||
$instance_ad_link[$i] = isset($instance[$ad_link]) ? esc_attr($instance[$ad_link]) : '';
|
||||
|
||||
}
|
||||
?>
|
||||
<p><label for="<?php echo $this -> get_field_id('title'); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('title'); ?>" name="<?php echo $this -> get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this -> get_field_id('number'); ?>"><?php _e('Number of ads to show:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('number'); ?>" name="<?php echo $this -> get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" /></p>
|
||||
|
||||
<div>
|
||||
<?php for ($i = 1; $i <= $number; $i++) : $ad_title = 'ad_'.$i.'_title'; $ad_image = 'ad_'.$i.'_image'; $ad_link = 'ad_'.$i.'_link'; ?>
|
||||
<div>
|
||||
<p><strong><?php _e('Advertise', 'pk_translate'); ?> <?php echo $i; ?>:</strong></p>
|
||||
<p><label for="<?php echo $this -> get_field_id($ad_title); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id($ad_title); ?>" name="<?php echo $this -> get_field_name($ad_title); ?>" type="text" value="<?php echo $instance_ad_title[$i]; ?>" /></p>
|
||||
<p><label for="<?php echo $this -> get_field_id($ad_image); ?>"><?php _e('Image URL:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id($ad_image); ?>" name="<?php echo $this -> get_field_name($ad_image); ?>" type="text" value="<?php echo $instance_ad_image[$i]; ?>" /></p>
|
||||
<p><label for="<?php echo $this -> get_field_id($ad_link); ?>"><?php _e('Link:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id($ad_link); ?>" name="<?php echo $this -> get_field_name($ad_link); ?>" type="text" value="<?php echo $instance_ad_link[$i]; ?>" /></p>
|
||||
</div>
|
||||
<?php endfor;?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_widgets_advertising_125_125() {
|
||||
|
||||
register_widget('PK_Widget_Advertising_125_125');
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', 'pk_widgets_advertising_125_125');
|
||||
|
||||
?>
|
@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
class PK_Widget_Advertising_300_250 extends WP_Widget {
|
||||
|
||||
function PK_Widget_Advertising_300_250() {
|
||||
|
||||
$widget_ops = array('classname' => 'widget_advertising_300_250', 'description' => __('Displays your 300 x 250 ads', 'pk_translate'));
|
||||
$this -> WP_Widget('pk-advertising-300-250', __('Advertising 300 x 250', 'pk_translate'), $widget_ops);
|
||||
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
extract($args);
|
||||
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
|
||||
if (empty($title)) $title = false;
|
||||
|
||||
$number = absint($instance['number']);
|
||||
|
||||
$instance_ad_title = array();
|
||||
$instance_ad_image = array();
|
||||
$instance_ad_link = array();
|
||||
|
||||
for ($i = 1; $i <= $number; $i++) {
|
||||
|
||||
$ad_title = 'ad_'.$i.'_title';
|
||||
$instance_ad_title[$i] = isset($instance[$ad_title]) ? $instance[$ad_title] : '';
|
||||
$ad_image = 'ad_'.$i.'_image';
|
||||
$instance_ad_image[$i] = isset($instance[$ad_image]) ? $instance[$ad_image] : '';
|
||||
$ad_link = 'ad_'.$i.'_link';
|
||||
$instance_ad_link[$i] = isset($instance[$ad_link]) ? $instance[$ad_link] : '';
|
||||
|
||||
}
|
||||
|
||||
echo '<!-- pk start pk-advertising-300-250 widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) {
|
||||
|
||||
echo $before_title;
|
||||
echo $title;
|
||||
echo $after_title;
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
<?php for ($i = 1; $i <= $number; $i++) : ?>
|
||||
<a href="<?php echo $instance_ad_link[$i]; ?>" title="<?php echo $instance_ad_title[$i]; ?>"><img src="<?php echo $instance_ad_image[$i]; ?>" alt="<?php echo $instance_ad_title[$i]; ?>" style="width:100%;" /></a>
|
||||
<?php endfor; ?>
|
||||
<?php
|
||||
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-advertising-300-250 widget -->
|
||||
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
|
||||
$instance = $old_instance;
|
||||
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
$instance['number'] = $new_instance['number'];
|
||||
|
||||
for ($i = 1; $i <= absint($instance['number']); $i++) {
|
||||
|
||||
$instance['ad_'.$i.'_title'] = strip_tags($new_instance['ad_'.$i.'_title']);
|
||||
$instance['ad_'.$i.'_image'] = strip_tags($new_instance['ad_'.$i.'_image']);
|
||||
$instance['ad_'.$i.'_link'] = strip_tags($new_instance['ad_'.$i.'_link']);
|
||||
|
||||
}
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
|
||||
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
||||
$number = isset($instance['number']) ? absint($instance['number']) : 1;
|
||||
|
||||
$instance_ad_title = array();
|
||||
$instance_ad_image = array();
|
||||
$instance_ad_link = array();
|
||||
|
||||
for ($i = 1; $i <= $number; $i++) {
|
||||
|
||||
$ad_title = 'ad_'.$i.'_title';
|
||||
$instance_ad_title[$i] = isset($instance[$ad_title]) ? $instance[$ad_title] : '';
|
||||
$ad_image = 'ad_'.$i.'_image';
|
||||
$instance_ad_image[$i] = isset($instance[$ad_image]) ? esc_attr($instance[$ad_image]) : '';
|
||||
$ad_link = 'ad_'.$i.'_link';
|
||||
$instance_ad_link[$i] = isset($instance[$ad_link]) ? esc_attr($instance[$ad_link]) : '';
|
||||
|
||||
}
|
||||
?>
|
||||
<p><label for="<?php echo $this -> get_field_id('title'); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('title'); ?>" name="<?php echo $this -> get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this -> get_field_id('number'); ?>"><?php _e('Number of ads to show:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('number'); ?>" name="<?php echo $this -> get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" /></p>
|
||||
|
||||
<div>
|
||||
<?php for ($i = 1; $i <= $number; $i++) : $ad_title = 'ad_'.$i.'_title'; $ad_image = 'ad_'.$i.'_image'; $ad_link = 'ad_'.$i.'_link'; ?>
|
||||
<div>
|
||||
<p><strong><?php _e('Advertise', 'pk_translate'); ?> <?php echo $i; ?>:</strong></p>
|
||||
<p><label for="<?php echo $this -> get_field_id($ad_title); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id($ad_title); ?>" name="<?php echo $this -> get_field_name($ad_title); ?>" type="text" value="<?php echo $instance_ad_title[$i]; ?>" /></p>
|
||||
<p><label for="<?php echo $this -> get_field_id($ad_image); ?>"><?php _e('Image URL:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id($ad_image); ?>" name="<?php echo $this -> get_field_name($ad_image); ?>" type="text" value="<?php echo $instance_ad_image[$i]; ?>" /></p>
|
||||
<p><label for="<?php echo $this -> get_field_id($ad_link); ?>"><?php _e('Link:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id($ad_link); ?>" name="<?php echo $this -> get_field_name($ad_link); ?>" type="text" value="<?php echo $instance_ad_link[$i]; ?>" /></p>
|
||||
</div>
|
||||
<?php endfor;?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_widgets_advertising_300_250() {
|
||||
|
||||
register_widget('PK_Widget_Advertising_300_250');
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', 'pk_widgets_advertising_300_250');
|
||||
|
||||
?>
|
@ -0,0 +1,166 @@
|
||||
<?php
|
||||
|
||||
class PK_Widget_Dribbble extends WP_Widget {
|
||||
|
||||
function PK_Widget_Dribbble(){
|
||||
|
||||
$widget_ops = array('classname' => 'widget_dribbble', 'description' => __('Display your Dribbble updates', 'pk_translate'));
|
||||
$this -> WP_Widget('pk-dribbble', __('Dribbble', 'pk_translate'), $widget_ops);
|
||||
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
extract($args);
|
||||
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
|
||||
if (empty($title)) $title = false;
|
||||
|
||||
$username = (isset($instance['username'])) ? urlencode($instance['username']) : '';
|
||||
|
||||
if (empty($username)) return;
|
||||
|
||||
$number = (isset($instance['number'])) ? absint($instance['number']) : 3;
|
||||
|
||||
$total = 0;
|
||||
|
||||
echo '<!-- pk start pk-dribbble widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) {
|
||||
|
||||
echo $before_title;
|
||||
echo $title;
|
||||
echo $after_title;
|
||||
|
||||
}
|
||||
|
||||
require_once(ABSPATH.WPINC.'/feed.php');
|
||||
|
||||
$dribbble_feed_url = "http://dribbble.com/$username/shots.rss";
|
||||
|
||||
$transients = get_option('pk_dribbble_transients');
|
||||
$transients[] = $args['widget_id'];
|
||||
update_option('pk_dribbble_transients', array_unique($transients));
|
||||
|
||||
$cache = get_transient($args['widget_id']);
|
||||
|
||||
if ($cache) {
|
||||
|
||||
echo $cache;
|
||||
return;
|
||||
|
||||
} else {
|
||||
|
||||
$feed = fetch_feed($dribbble_feed_url);
|
||||
|
||||
}
|
||||
|
||||
if (!is_wp_error($feed)) {
|
||||
|
||||
$total = $feed -> get_item_quantity($number);
|
||||
$items = $feed -> get_items(0, $total);
|
||||
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
if ($total == 0) :
|
||||
|
||||
echo '<p>'.__('The Dribble feed is either empty or unavailable. Please check back later.', 'pk_translate').'</p>';
|
||||
|
||||
else :
|
||||
?>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
foreach($items as $item) :
|
||||
|
||||
$author = $item -> get_author();
|
||||
$text = $item -> get_title();
|
||||
$link = $item -> get_permalink();
|
||||
$time = $item -> get_date('d F, Y');
|
||||
$description = $item -> get_description();
|
||||
|
||||
preg_match("/src=\"(http.*(jpg|jpeg|gif|png))/", $description, $image_url);
|
||||
$image = $image_url[1];
|
||||
?>
|
||||
<li>
|
||||
<?php
|
||||
if ($image) :
|
||||
?>
|
||||
<a href="<?php echo $link; ?>" title="<?php echo $text; ?>" rel="external nofollow">
|
||||
<img src="<?php echo $image; ?>" style="width:100%;" />
|
||||
</a>
|
||||
<h5><?php echo $text; ?></h5>
|
||||
<small><?php echo __('By:', 'pk_translate').' '.$username.' . '.$time; ?></small>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
</li>
|
||||
<?php
|
||||
endforeach;
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-dribbble widget -->
|
||||
|
||||
';
|
||||
|
||||
set_transient($args['widget_id'], ob_get_flush(), 3600);
|
||||
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
|
||||
$instance = $old_instance;
|
||||
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
$instance['username'] = $new_instance['username'];
|
||||
$instance['number'] = absint($new_instance['number']);
|
||||
|
||||
$transients = get_option('pk_dribbble_transients');
|
||||
|
||||
foreach ($transients as $transient) {
|
||||
|
||||
delete_transient($transient);
|
||||
|
||||
}
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
|
||||
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
||||
$username = (isset($instance['username'])) ? $instance['username'] : '';
|
||||
$number = (isset($instance['number'])) ? absint($instance['number']) : 3;
|
||||
?>
|
||||
<p><label for="<?php echo $this -> get_field_id('title'); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('title'); ?>" name="<?php echo $this -> get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this -> get_field_id('username'); ?>"><?php _e('Dribbble username:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('username'); ?>" name="<?php echo $this -> get_field_name('username'); ?>" type="text" value="<?php echo $username; ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this -> get_field_id('number'); ?>"><?php _e('Number of updates to show:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('number'); ?>" name="<?php echo $this -> get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" /></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_widgets_dribbble() {
|
||||
|
||||
register_widget('PK_Widget_Dribbble');
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', 'pk_widgets_dribbble');
|
||||
|
||||
?>
|
@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
class PK_Widget_Featured_Posts extends WP_Widget {
|
||||
|
||||
function PK_Widget_Featured_Posts() {
|
||||
|
||||
$widget_ops = array('classname' => 'widget_featured_posts', 'description' => __('Displays the featured posts', 'pk_translate'));
|
||||
$this -> WP_Widget('pk-featured-posts', __('Featured Posts', 'pk_translate'), $widget_ops);
|
||||
$this -> alt_option_name = 'widget_featured_posts';
|
||||
|
||||
add_action('save_post', array(&$this, 'flush_widget_cache'));
|
||||
add_action('deleted_post', array(&$this, 'flush_widget_cache'));
|
||||
add_action('switch_theme', array(&$this, 'flush_widget_cache'));
|
||||
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
$cache = wp_cache_get('widget_featured_posts', 'widget');
|
||||
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
$number = absint($instance['number']);
|
||||
|
||||
if (empty($title)) $title = false;
|
||||
|
||||
$selected_categories = (isset($instance['selected_categories']) && !empty($instance['selected_categories'])) ? $instance['selected_categories'] : array();
|
||||
$selected_order_by = (isset($instance['selected_order_by']) && !empty($instance['selected_order_by'])) ? $instance['selected_order_by'] : 'date';
|
||||
|
||||
if (!is_array($cache)) {
|
||||
|
||||
$cache = array();
|
||||
|
||||
}
|
||||
|
||||
if (isset($cache[$args['widget_id']])) {
|
||||
|
||||
echo $cache[$args['widget_id']];
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
ob_start();
|
||||
extract($args);
|
||||
|
||||
$r = new WP_Query(array('post_type' => 'post', 'posts_per_page' => $number, 'category__in' => $selected_categories, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'orderby' => $selected_order_by, 'order' => 'DESC'));
|
||||
|
||||
if ($r -> have_posts()) :
|
||||
|
||||
echo '<!-- pk start pk-featured-posts widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) echo $before_title.$title.$after_title;
|
||||
?>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
while ($r -> have_posts()) :
|
||||
|
||||
$r -> the_post();
|
||||
?>
|
||||
<li<?php if (!has_post_thumbnail()) echo ' class="pk_no_thumbnail"'; ?>>
|
||||
<?php if (has_post_thumbnail()) the_post_thumbnail('thumb'); ?>
|
||||
|
||||
<div>
|
||||
<h5><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h5>
|
||||
<?php add_filter('excerpt_length', 'pk_widgets_excerpt_filter'); add_filter('excerpt_more', 'pk_excerpt_more'); the_excerpt(); ?>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
endwhile;
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-featured-posts widget -->
|
||||
|
||||
';
|
||||
|
||||
endif;
|
||||
|
||||
wp_reset_postdata();
|
||||
|
||||
$cache[$args['widget_id']] = ob_get_flush();
|
||||
|
||||
wp_cache_set('widget_featured_posts', $cache, 'widget');
|
||||
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
|
||||
$instance = $old_instance;
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
$instance['number'] = (int) $new_instance['number'];
|
||||
$instance['selected_categories'] = $new_instance['selected_categories'];
|
||||
$instance['selected_order_by'] = $new_instance['selected_order_by'];
|
||||
|
||||
$this -> flush_widget_cache();
|
||||
|
||||
$alloptions = wp_cache_get('alloptions', 'options');
|
||||
|
||||
if (isset($alloptions['widget_featured_posts'])) {
|
||||
|
||||
delete_option('widget_featured_posts');
|
||||
|
||||
}
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
function flush_widget_cache() {
|
||||
|
||||
wp_cache_delete('widget_featured_posts', 'widget');
|
||||
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
|
||||
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
||||
$number = isset($instance['number']) ? absint($instance['number']) : 5;
|
||||
$selected_categories = (isset($instance['selected_categories']) && !empty($instance['selected_categories'])) ? $instance['selected_categories'] : array();
|
||||
$selected_order_by = (isset($instance['selected_order_by']) && !empty($instance['selected_order_by'])) ? $instance['selected_order_by'] : 'date';
|
||||
?>
|
||||
<p><label for="<?php echo $this -> get_field_id('title'); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('title'); ?>" name="<?php echo $this -> get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this -> get_field_id('number'); ?>"><?php _e('Number of posts to show:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('number'); ?>" name="<?php echo $this -> get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo $this -> get_field_id('selected_categories'); ?>"><?php _e('Select categories:', 'pk_translate'); ?></label>
|
||||
<select class="widefat" id="<?php echo $this -> get_field_id('selected_categories'); ?>" name="<?php echo $this -> get_field_name('selected_categories'); ?>[]" multiple="multiple" style="height:auto"><?php
|
||||
|
||||
$categories = get_categories(array('hide_empty' => 1, 'hierarchical' => false, 'taxonomy' => 'category'));
|
||||
|
||||
if ($categories) {
|
||||
|
||||
foreach ($categories as $category) {
|
||||
|
||||
if (in_array($category -> term_id, $selected_categories)) {
|
||||
|
||||
$selected_string = ' selected="selected"';
|
||||
|
||||
} else {
|
||||
|
||||
$selected_string = '';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
<option value="'.$category -> term_id.'"'.$selected_string.'>'.$category -> name.'</option>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?></select>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo $this -> get_field_id('selected_order_by'); ?>"><?php _e('Order posts by:', 'pk_translate'); ?></label>
|
||||
<select class="widefat" id="<?php echo $this -> get_field_id('selected_order_by'); ?>" name="<?php echo $this -> get_field_name('selected_order_by'); ?>">
|
||||
<option value="date"<?php if ($selected_order_by == 'date') echo ' selected="selected"';?>><?php _e('Date', 'pk_translate'); ?></option>
|
||||
<option value="comment_count"<?php if ($selected_order_by == 'comment_count') echo ' selected="selected"';?>><?php _e('Comments Count', 'pk_translate'); ?></option>
|
||||
<option value="title"<?php if ($selected_order_by == 'title') echo ' selected="selected"';?>><?php _e('Title', 'pk_translate'); ?></option>
|
||||
<option value="author"<?php if ($selected_order_by == 'author') echo ' selected="selected"';?>><?php _e('Author', 'pk_translate'); ?></option>
|
||||
<option value="rand"<?php if ($selected_order_by == 'rand') echo ' selected="selected"';?>><?php _e('Random', 'pk_translate'); ?></option>
|
||||
</select>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_widgets_featured_posts() {
|
||||
|
||||
register_widget('PK_Widget_Featured_Posts');
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', 'pk_widgets_featured_posts');
|
||||
|
||||
?>
|
@ -0,0 +1,185 @@
|
||||
<?php
|
||||
|
||||
class PK_Widget_Featured_Works extends WP_Widget {
|
||||
|
||||
function PK_Widget_Featured_Works() {
|
||||
|
||||
$widget_ops = array('classname' => 'widget_featured_works', 'description' => __('Displays the featured works', 'pk_translate'));
|
||||
$this -> WP_Widget('pk-featured-works', __('Featured Works', 'pk_translate'), $widget_ops);
|
||||
$this -> alt_option_name = 'widget_featured_works';
|
||||
|
||||
add_action('save_post', array(&$this, 'flush_widget_cache'));
|
||||
add_action('deleted_post', array(&$this, 'flush_widget_cache'));
|
||||
add_action('switch_theme', array(&$this, 'flush_widget_cache'));
|
||||
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
$cache = wp_cache_get('widget_featured_works', 'widget');
|
||||
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
$number = absint($instance['number']);
|
||||
|
||||
if (empty($title)) $title = false;
|
||||
|
||||
$selected_portfolio_categories = (isset($instance['selected_portfolio_categories']) && !empty($instance['selected_portfolio_categories'])) ? $instance['selected_portfolio_categories'] : array();
|
||||
$selected_order_by = (isset($instance['selected_order_by']) && !empty($instance['selected_order_by'])) ? $instance['selected_order_by'] : 'date';
|
||||
|
||||
if (!is_array($cache)) {
|
||||
|
||||
$cache = array();
|
||||
|
||||
}
|
||||
|
||||
if (isset($cache[$args['widget_id']])) {
|
||||
|
||||
echo $cache[$args['widget_id']];
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
ob_start();
|
||||
extract($args);
|
||||
|
||||
$r = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => $number, 'tax_query' => array(array('taxonomy' => 'taxonomy_portfolio', 'terms' => $selected_portfolio_categories)), 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'orderby' => $selected_order_by, 'order' => ($selected_order_by == 'menu_order') ? 'ASC' : 'DESC'));
|
||||
|
||||
if ($r -> have_posts()) :
|
||||
|
||||
echo '<!-- pk start pk-featured-works widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) echo $before_title.$title.$after_title;
|
||||
?>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
while ($r -> have_posts()) :
|
||||
|
||||
$r -> the_post();
|
||||
?>
|
||||
<li<?php if (!has_post_thumbnail()) echo ' class="pk_no_thumbnail"'; ?>>
|
||||
<?php if (has_post_thumbnail()) the_post_thumbnail('thumb'); ?>
|
||||
|
||||
<div>
|
||||
<h5><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h5>
|
||||
<?php add_filter('excerpt_length', 'pk_widgets_excerpt_filter'); add_filter('excerpt_more', 'pk_excerpt_more'); the_excerpt(); ?>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
endwhile;
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-featured-works widget -->
|
||||
|
||||
';
|
||||
|
||||
endif;
|
||||
|
||||
wp_reset_postdata();
|
||||
|
||||
$cache[$args['widget_id']] = ob_get_flush();
|
||||
|
||||
wp_cache_set('widget_featured_works', $cache, 'widget');
|
||||
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
|
||||
$instance = $old_instance;
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
$instance['number'] = (int) $new_instance['number'];
|
||||
$instance['selected_portfolio_categories'] = $new_instance['selected_portfolio_categories'];
|
||||
$instance['selected_order_by'] = $new_instance['selected_order_by'];
|
||||
|
||||
$this -> flush_widget_cache();
|
||||
|
||||
$alloptions = wp_cache_get('alloptions', 'options');
|
||||
|
||||
if (isset($alloptions['widget_featured_works'])) {
|
||||
|
||||
delete_option('widget_featured_works');
|
||||
|
||||
}
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
function flush_widget_cache() {
|
||||
|
||||
wp_cache_delete('widget_featured_works', 'widget');
|
||||
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
|
||||
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
||||
$number = isset($instance['number']) ? absint($instance['number']) : 5;
|
||||
$selected_portfolio_categories = (isset($instance['selected_portfolio_categories']) && !empty($instance['selected_portfolio_categories'])) ? $instance['selected_portfolio_categories'] : array();
|
||||
$selected_order_by = (isset($instance['selected_order_by']) && !empty($instance['selected_order_by'])) ? $instance['selected_order_by'] : 'date';
|
||||
?>
|
||||
<p><label for="<?php echo $this -> get_field_id('title'); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('title'); ?>" name="<?php echo $this -> get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this -> get_field_id('number'); ?>"><?php _e('Number of works to show:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('number'); ?>" name="<?php echo $this -> get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo $this -> get_field_id('selected_portfolio_categories'); ?>"><?php _e('Select categories:', 'pk_translate'); ?></label>
|
||||
<select class="widefat" id="<?php echo $this -> get_field_id('selected_portfolio_categories'); ?>" name="<?php echo $this -> get_field_name('selected_portfolio_categories'); ?>[]" multiple="multiple" style="height:auto"><?php
|
||||
|
||||
$categories = get_categories(array('hide_empty' => 1, 'hierarchical' => false, 'taxonomy' => 'taxonomy_portfolio'));
|
||||
|
||||
if ($categories) {
|
||||
|
||||
foreach ($categories as $category) {
|
||||
|
||||
if (in_array($category -> term_id, $selected_portfolio_categories)) {
|
||||
|
||||
$selected_string = ' selected="selected"';
|
||||
|
||||
} else {
|
||||
|
||||
$selected_string = '';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
<option value="'.$category -> term_id.'"'.$selected_string.'>'.$category -> name.'</option>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?></select>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo $this -> get_field_id('selected_order_by'); ?>"><?php _e('Order works by:', 'pk_translate'); ?></label>
|
||||
<select class="widefat" id="<?php echo $this -> get_field_id('selected_order_by'); ?>" name="<?php echo $this -> get_field_name('selected_order_by'); ?>">
|
||||
<option value="menu_order"<?php if ($selected_order_by == 'menu_order') echo ' selected="selected"';?>><?php _e('Manual Sort', 'pk_translate'); ?></option>
|
||||
<option value="date"<?php if ($selected_order_by == 'date') echo ' selected="selected"';?>><?php _e('Date', 'pk_translate'); ?></option>
|
||||
<option value="comment_count"<?php if ($selected_order_by == 'comment_count') echo ' selected="selected"';?>><?php _e('Comments Count', 'pk_translate'); ?></option>
|
||||
<option value="title"<?php if ($selected_order_by == 'title') echo ' selected="selected"';?>><?php _e('Title', 'pk_translate'); ?></option>
|
||||
<option value="author"<?php if ($selected_order_by == 'author') echo ' selected="selected"';?>><?php _e('Author', 'pk_translate'); ?></option>
|
||||
<option value="rand"<?php if ($selected_order_by == 'rand') echo ' selected="selected"';?>><?php _e('Random', 'pk_translate'); ?></option>
|
||||
</select>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_widgets_featured_works() {
|
||||
|
||||
register_widget('PK_Widget_Featured_Works');
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', 'pk_widgets_featured_works');
|
||||
|
||||
?>
|
@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
class PK_Widget_Flickr extends WP_Widget {
|
||||
|
||||
function PK_Widget_Flickr() {
|
||||
|
||||
$widget_ops=array('classname' => 'widget_flickr', 'description' => __('Display your Flickr photos feed', 'pk_translate'));
|
||||
$this -> WP_Widget('pk-flickr', __('Flickr', 'pk_translate'), $widget_ops);
|
||||
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
extract($args);
|
||||
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
|
||||
if (empty($title)) $title = false;
|
||||
|
||||
$number = absint($instance['number']);
|
||||
$open_with_lightbox = (isset($instance['open_with_lightbox']) && $instance['open_with_lightbox']) ? 1 : 0;
|
||||
$feed = $instance['feed'];
|
||||
|
||||
if (empty($feed)) return;
|
||||
if ($feed != '') $feed .= '&format=rss_200';
|
||||
|
||||
require_once(ABSPATH.WPINC.'/feed.php');
|
||||
|
||||
echo '<!-- pk start pk-flickr widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) {
|
||||
|
||||
echo $before_title;
|
||||
echo $title;
|
||||
echo $after_title;
|
||||
|
||||
}
|
||||
|
||||
$transients = get_option('pk_flickr_transients');
|
||||
$transients[] = $args['widget_id'];
|
||||
update_option('pk_flickr_transients', array_unique($transients));
|
||||
|
||||
$cache = get_transient($args['widget_id']);
|
||||
|
||||
if ($cache) {
|
||||
|
||||
echo $cache;
|
||||
return;
|
||||
|
||||
} else {
|
||||
|
||||
$feed = fetch_feed($feed);
|
||||
|
||||
}
|
||||
|
||||
if ($feed != '' && !is_wp_error($feed)) :
|
||||
|
||||
$items = $feed -> get_items(0, $number);
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div class="flickr_widget">
|
||||
<?php
|
||||
foreach ($items as $item) : $item_media = $item -> get_enclosures();
|
||||
|
||||
if ($open_with_lightbox) :
|
||||
?>
|
||||
<a class="flickr_image_<?php echo $args['widget_id']; ?>" href="<?php echo esc_attr($item_media[0] -> link); ?>" title="<?php echo $item -> get_title(); ?>">
|
||||
<img src="<?php echo esc_attr(str_replace(array('_t.','_m.','_z.'), '_s.', $item_media[0] -> thumbnails[0])); ?>" />
|
||||
</a>
|
||||
<?php
|
||||
else :
|
||||
?>
|
||||
<a href="<?php echo esc_attr($item -> get_permalink()); ?>" title="<?php echo $item -> get_title(); ?>">
|
||||
<img src="<?php echo esc_attr(str_replace(array('_t.','_m.','_z.'), '_s.', $item_media[0] -> thumbnails[0])); ?>" />
|
||||
</a>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
endforeach;
|
||||
?>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery(".flickr_image_<?php echo $args['widget_id']; ?>").attr('rel', 'prettyPhoto[flickr_widget_<?php echo $args['widget_id']; ?>]').prettyPhoto(<?php echo PK_PRETTYPHOTO_PARAMS; ?>);
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
else :
|
||||
|
||||
echo '<p>'.__('The Flickr feed is either empty or unavailable. Please check back later.', 'pk_translate').'</p>';
|
||||
|
||||
endif;
|
||||
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-flickr widget -->
|
||||
|
||||
';
|
||||
|
||||
set_transient($args['widget_id'], ob_get_flush(), 3600);
|
||||
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
|
||||
$instance = $old_instance;
|
||||
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
$instance['number'] = absint($new_instance['number']);
|
||||
$instance['open_with_lightbox'] = $new_instance['open_with_lightbox'] ? 1 : 0;
|
||||
$instance['feed'] = $new_instance['feed'];
|
||||
|
||||
$transients = get_option('pk_flickr_transients');
|
||||
|
||||
foreach ($transients as $transient) {
|
||||
|
||||
delete_transient($transient);
|
||||
|
||||
}
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
|
||||
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
||||
$number = isset($instance['number']) ? absint($instance['number']) : 16;
|
||||
$open_with_lightbox = (isset($instance['open_with_lightbox']) && !empty($instance['open_with_lightbox'])) ? 'checked="checked"' : '';
|
||||
$feed = isset($instance['feed']) ? esc_attr($instance['feed']) : '';
|
||||
?>
|
||||
<p><label for="<?php echo $this -> get_field_id('title'); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('title'); ?>" name="<?php echo $this -> get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this -> get_field_id('number'); ?>"><?php _e('Number of thumbnails to show:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('number'); ?>" name="<?php echo $this -> get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" /></p>
|
||||
|
||||
<p><input class="checkbox" type="checkbox" <?php echo $open_with_lightbox; ?> id="<?php echo $this -> get_field_id('open_with_lightbox'); ?>" name="<?php echo $this -> get_field_name('open_with_lightbox'); ?>" />
|
||||
<label for="<?php echo $this -> get_field_id('open_with_lightbox'); ?>"><?php _e('Open photos with lightbox', 'pk_translate'); ?></label><br />
|
||||
|
||||
<p><label for="<?php echo $this -> get_field_id('feed'); ?>"><?php _e('Flickr RSS2 feed URL:', 'pk_translate', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('feed'); ?>" name="<?php echo $this -> get_field_name('feed'); ?>" type="text" value="<?php echo $feed; ?>" /></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_widgets_flickr() {
|
||||
|
||||
register_widget('PK_Widget_Flickr');
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', 'pk_widgets_flickr');
|
||||
|
||||
?>
|
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
class PK_Widget_Google_Maps extends WP_Widget {
|
||||
|
||||
function PK_Widget_Google_Maps() {
|
||||
|
||||
$widget_ops = array('classname' => 'widget_google_maps', 'description' => __('Displays Google Maps', 'pk_translate'));
|
||||
$this -> WP_Widget('pk-google-maps', __('Google Maps', 'pk_translate'), $widget_ops);
|
||||
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
extract($args);
|
||||
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
|
||||
if (empty($title)) $title = false;
|
||||
|
||||
$map_url = isset($instance['map_url']) ? esc_url($instance['map_url']) : '';
|
||||
$map_height = absint($instance['map_height']);
|
||||
|
||||
echo '<!-- pk start pk-google-maps widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) {
|
||||
|
||||
echo $before_title;
|
||||
echo $title;
|
||||
echo $after_title;
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="pk_widget_google_maps">
|
||||
<iframe src="<?php echo $map_url.'&output=embed'; ?>" style="width:100%; height:<?php echo $map_height; ?>px;"></iframe>
|
||||
</div>
|
||||
<?php
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-google-maps widget -->
|
||||
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
|
||||
$instance = $old_instance;
|
||||
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
$instance['map_url'] = esc_url($new_instance['map_url']);
|
||||
$instance['map_height'] = $new_instance['map_height'];
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
|
||||
$title = isset($instance['title']) ? $instance['title'] : '';
|
||||
$map_url = isset($instance['map_url']) ? esc_url($instance['map_url']) : '';
|
||||
$map_height = isset($instance['map_height']) ? absint($instance['map_height']) : 300;
|
||||
?>
|
||||
<p><label for="<?php echo $this -> get_field_id('title'); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('title'); ?>" name="<?php echo $this -> get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this -> get_field_id('map_url'); ?>"><?php _e('Map URL:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('map_url'); ?>" name="<?php echo $this -> get_field_name('map_url'); ?>" type="text" value="<?php echo $map_url; ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this -> get_field_id('map_height'); ?>"><?php _e('Map height:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('map_height'); ?>" name="<?php echo $this -> get_field_name('map_height'); ?>" type="text" value="<?php echo $map_height; ?>" /></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_widgets_google_maps() {
|
||||
|
||||
register_widget('PK_Widget_Google_Maps');
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', 'pk_widgets_google_maps');
|
||||
|
||||
?>
|
@ -0,0 +1,721 @@
|
||||
<?php
|
||||
|
||||
class PK_Widget_Links extends WP_Widget_Links {
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
extract($args, EXTR_SKIP);
|
||||
|
||||
$show_description = isset($instance['description']) ? $instance['description'] : false;
|
||||
$show_name = isset($instance['name']) ? $instance['name'] : false;
|
||||
$show_rating = isset($instance['rating']) ? $instance['rating'] : false;
|
||||
$show_images = isset($instance['images']) ? $instance['images'] : true;
|
||||
$category = isset($instance['category']) ? $instance['category'] : false;
|
||||
|
||||
if (is_admin() && !$category) {
|
||||
|
||||
echo $before_widget.$before_title. __('All Links', 'pk_translate').$after_title.$after_widget;
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
$before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget);
|
||||
|
||||
$before_widget = '<!-- pk start pk-links widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
$after_widget = $after_widget.'
|
||||
<!-- pk end pk-links widget -->
|
||||
';
|
||||
|
||||
$output = wp_list_bookmarks(apply_filters('widget_links_args', array(
|
||||
'title_before' => $before_title, 'title_after' => $after_title,
|
||||
'category_before' => $before_widget, 'category_after' => $after_widget,
|
||||
'show_images' => $show_images, 'show_description' => $show_description,
|
||||
'show_name' => $show_name, 'show_rating' => $show_rating,
|
||||
'category' => $category, 'class' => 'linkcat widget',
|
||||
'echo' => 0
|
||||
)));
|
||||
|
||||
echo str_replace(array("</a>\n", "\n</li>", "<li>", "\n\n\t"), array("</a>", "</li>", "\t\t<li>", "\n\t"), $output);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PK_Widget_Calendar extends WP_Widget_Calendar {
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
extract($args);
|
||||
|
||||
$title = apply_filters('widget_title', empty($instance['title']) ? ' ' : $instance['title'], $instance, $this -> id_base);
|
||||
|
||||
echo '<!-- pk start pk-calendar widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) echo $before_title.$title.$after_title;
|
||||
|
||||
echo '
|
||||
<div id="calendar_wrap" class="table rounded">
|
||||
';
|
||||
|
||||
get_calendar();
|
||||
|
||||
echo '
|
||||
</div>
|
||||
';
|
||||
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-calendar widget -->
|
||||
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PK_Widget_Meta extends WP_Widget_Meta {
|
||||
|
||||
function PK_Widget_Meta() {
|
||||
|
||||
$widget_ops = array('classname' => 'widget_meta', 'description' => __('Log in/out, feed and WP links', 'pk_translate'));
|
||||
$this -> WP_Widget('meta', __('Meta', 'pk_translate'), $widget_ops);
|
||||
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
extract($args);
|
||||
|
||||
$title = apply_filters('widget_title', empty($instance['title']) ? __('Meta', 'pk_translate') : $instance['title'], $instance, $this -> id_base);
|
||||
|
||||
echo '<!-- pk start pk-meta widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) echo $before_title.$title.$after_title;
|
||||
?>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
if (get_option('users_can_register') && !is_user_logged_in()) :
|
||||
?>
|
||||
<li><a href="#pk_register_form" class="pk_meta_register"><?php _e('Register', 'pk_translate'); ?></a></li>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
if (is_user_logged_in() || !get_option('users_can_register')) :
|
||||
?>
|
||||
<li><?php wp_loginout(); ?></li>
|
||||
<?php
|
||||
else :
|
||||
?>
|
||||
<li><a href="#pk_login_form" class="pk_meta_login"><?php _e('Log in', 'pk_translate'); ?></a></li>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
<li><a href="<?php bloginfo('rss2_url'); ?>" title="<?php echo esc_attr(__('Syndicate this site using RSS 2.0', 'pk_translate')); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>', 'pk_translate'); ?></a></li>
|
||||
<li><a href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php echo esc_attr(__('The latest comments to all posts in RSS', 'pk_translate')); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>', 'pk_translate'); ?></a></li>
|
||||
<li><a href="http://wordpress.org/" title="<?php echo esc_attr(__('Powered by WordPress, state-of-the-art semantic personal publishing platform.', 'pk_translate')); ?>">WordPress.org</a></li>
|
||||
<?php
|
||||
wp_meta();
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-meta widget -->
|
||||
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PK_Widget_Categories extends WP_Widget_Categories {
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
extract($args);
|
||||
|
||||
$title = apply_filters('widget_title', empty($instance['title']) ? __('Categories', 'pk_translate') : $instance['title'], $instance, $this -> id_base);
|
||||
$c = $instance['count'] ? '1' : '0';
|
||||
$h = $instance['hierarchical'] ? '1' : '0';
|
||||
$d = $instance['dropdown'] ? '1' : '0';
|
||||
|
||||
echo '<!-- pk start pk-categories widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) echo $before_title.$title.$after_title;
|
||||
|
||||
$cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h, 'echo' => 0);
|
||||
|
||||
if ($d) {
|
||||
|
||||
$cat_args['show_option_none'] = __('Select Category', 'pk_translate');
|
||||
|
||||
echo '
|
||||
'.str_replace(array("<select", "<option", "</select"), array("\t<select", "\t<option", "\t</select"), wp_dropdown_categories(apply_filters('widget_categories_dropdown_args', $cat_args)));
|
||||
?>
|
||||
<script type='text/javascript'>
|
||||
/* <![CDATA[ */
|
||||
var dropdown = document.getElementById("cat");
|
||||
function onCatChange() {
|
||||
if (dropdown.options[dropdown.selectedIndex].value > 0) {
|
||||
location.href = "<?php echo home_url(); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value;
|
||||
}
|
||||
}
|
||||
dropdown.onchange = onCatChange;
|
||||
/* ]]> */
|
||||
</script>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
echo str_replace(array("\n</a>", "\n</li>", "<li"), array("</a>", "</li>", "\t<li"), wp_list_categories(apply_filters('widget_categories_args', $cat_args)));
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-categories widget -->
|
||||
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PK_Widget_Recent_Comments extends WP_Widget_Recent_Comments {
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
global $comments, $comment;
|
||||
|
||||
$cache = wp_cache_get('widget_recent_comments', 'widget');
|
||||
|
||||
if (!is_array($cache)) $cache = array();
|
||||
|
||||
if (isset($cache[$args['widget_id']])) {
|
||||
|
||||
echo $cache[$args['widget_id']];
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
extract($args, EXTR_SKIP);
|
||||
|
||||
$output = '';
|
||||
|
||||
$title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Comments', 'pk_translate') : $instance['title']);
|
||||
|
||||
if (!$number = absint($instance['number'])) $number = 5;
|
||||
|
||||
$comments = get_comments(array('number' => $number, 'status' => 'approve'));
|
||||
|
||||
$output .= '<!-- pk start pk-recent-comments widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) $output .= $before_title.$title.$after_title;
|
||||
|
||||
$output .= '
|
||||
<ul id="recentcomments">';
|
||||
|
||||
if ($comments) {
|
||||
|
||||
foreach ((array)$comments as $comment) {
|
||||
|
||||
$output .= '
|
||||
<li class="recentcomments">'.sprintf(__('%1$s on %2$s', 'pk_translate'), get_comment_author_link(), '<a href="'.esc_url(get_comment_link($comment -> comment_ID)).'">'.get_the_title($comment -> comment_post_ID).'</a>').'</li>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$output .= '
|
||||
</ul>
|
||||
';
|
||||
$output .= $after_widget.'
|
||||
<!-- pk end pk-recent-comments widget -->
|
||||
|
||||
';
|
||||
|
||||
echo $output;
|
||||
|
||||
$cache[$args['widget_id']] = $output;
|
||||
|
||||
wp_cache_set('widget_recent_comments', $cache, 'widget');
|
||||
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
|
||||
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
||||
$number = isset($instance['number']) ? absint($instance['number']) : 5;
|
||||
?>
|
||||
<p><label for="<?php echo $this -> get_field_id('title'); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('title'); ?>" name="<?php echo $this -> get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this -> get_field_id('number'); ?>"><?php _e('Number of posts to show:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('number'); ?>" name="<?php echo $this -> get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" /></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PK_Widget_Pages extends WP_Widget_Pages {
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
extract($args);
|
||||
|
||||
$title = apply_filters('widget_title', empty($instance['title']) ? __('Pages', 'pk_translate') : $instance['title'], $instance, $this -> id_base);
|
||||
$sortby = empty($instance['sortby']) ? 'menu_order' : $instance['sortby'];
|
||||
$exclude = empty($instance['exclude']) ? '' : $instance['exclude'];
|
||||
|
||||
if ($sortby == 'menu_order') $sortby = 'menu_order, post_title';
|
||||
|
||||
$output = wp_list_pages(apply_filters('widget_pages_args', array('title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude)));
|
||||
|
||||
if (!empty($output)) {
|
||||
|
||||
echo '<!-- pk start pk-pages widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) echo $before_title.$title.$after_title;
|
||||
?>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
echo $output;
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-pages widget -->
|
||||
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
|
||||
$instance = wp_parse_args((array) $instance, array('sortby' => 'post_title', 'title' => '', 'exclude' => ''));
|
||||
$title = esc_attr($instance['title']);
|
||||
$exclude = empty($instance['exclude']) ? '' : esc_attr($instance['exclude']);
|
||||
?>
|
||||
<p><label for="<?php echo $this -> get_field_id('title'); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('title'); ?>" name="<?php echo $this -> get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo $this -> get_field_id('sortby'); ?>"><?php _e('Sort by:', 'pk_translate'); ?></label>
|
||||
<select name="<?php echo $this -> get_field_name('sortby'); ?>" id="<?php echo $this -> get_field_id('sortby'); ?>" class="widefat">
|
||||
<option value="menu_order"<?php selected($instance['sortby'], 'menu_order'); ?>><?php _e('Menu order', 'pk_translate'); ?></option>
|
||||
<option value="post_title"<?php selected($instance['sortby'], 'post_title'); ?>><?php _e('Page title', 'pk_translate'); ?></option>
|
||||
<option value="ID"<?php selected($instance['sortby'], 'ID'); ?>><?php _e('Page ID', 'pk_translate'); ?></option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo $this -> get_field_id('exclude'); ?>"><?php _e('Exclude:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('exclude'); ?>" name="<?php echo $this -> get_field_name('exclude'); ?>" type="text" value="<?php echo $exclude; ?>" />
|
||||
<br /><small><?php _e('Page IDs, separated by commas.' ,'pk_translate'); ?></small>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PK_Widget_Archives extends WP_Widget_Archives {
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
extract($args);
|
||||
|
||||
$c = $instance['count'] ? '1' : '0';
|
||||
$d = $instance['dropdown'] ? '1' : '0';
|
||||
$title = apply_filters('widget_title', empty($instance['title']) ? __('Archives', 'pk_translate') : $instance['title'], $instance, $this -> id_base);
|
||||
|
||||
echo '<!-- pk start pk-archives widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) echo $before_title.$title.$after_title;
|
||||
|
||||
if ($d) {
|
||||
?>
|
||||
|
||||
<select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'>
|
||||
<option value=""><?php echo esc_attr(__('Select Month', 'pk_translate')); ?></option>
|
||||
<?php
|
||||
echo str_replace(array("<option", "> ", " </"), array("\t<option", ">", "</"), wp_get_archives(apply_filters('widget_archives_dropdown_args', array('type' => 'monthly', 'format' => 'option', 'show_post_count' => $c, 'echo' => 0))));
|
||||
?>
|
||||
</select>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
echo str_replace("<li>", "\t<li>", wp_get_archives(apply_filters('widget_archives_args', array('type' => 'monthly', 'show_post_count' => $c, 'echo' => 0))));
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-archives widget -->
|
||||
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PK_Nav_Menu_Widget extends WP_Nav_Menu_Widget {
|
||||
|
||||
function PK_Nav_Menu_Widget() {
|
||||
|
||||
$widget_ops = array('description' => __('Add one of your custom menus', 'pk_translate'));
|
||||
parent::WP_Widget('nav_menu', __('Custom Menu', 'pk_translate'), $widget_ops);
|
||||
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
$nav_menu = wp_get_nav_menu_object($instance['nav_menu']);
|
||||
|
||||
if (!$nav_menu) return;
|
||||
|
||||
$instance['title'] = apply_filters('widget_title', $instance['title'], $instance, $this -> id_base);
|
||||
|
||||
echo '<!-- pk start pk-custom-menu widget -->
|
||||
'.$args['before_widget'].'
|
||||
';
|
||||
|
||||
if (!empty($instance['title'])) echo $args['before_title'].$instance['title'].$args['after_title'].'
|
||||
';
|
||||
|
||||
wp_nav_menu(array('fallback_cb' => '', 'menu' => $nav_menu));
|
||||
|
||||
echo '
|
||||
'.$args['after_widget'].'
|
||||
<!-- pk end pk-custom-menu widget -->
|
||||
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
|
||||
$title = isset($instance['title']) ? $instance['title'] : '';
|
||||
$nav_menu = isset($instance['nav_menu']) ? $instance['nav_menu'] : '';
|
||||
|
||||
$menus = get_terms('nav_menu', array('hide_empty' => false));
|
||||
|
||||
if (!$menus) {
|
||||
|
||||
echo '<p>'. sprintf(__('No menus have been created yet. <a href="%s">Create some</a>.', 'pk_translate'), admin_url('nav-menus.php')) .'</p>';
|
||||
return;
|
||||
|
||||
}
|
||||
?>
|
||||
<p>
|
||||
<label for="<?php echo $this -> get_field_id('title'); ?>"><?php _e('Title:', 'pk_translate') ?></label>
|
||||
<input type="text" class="widefat" id="<?php echo $this -> get_field_id('title'); ?>" name="<?php echo $this -> get_field_name('title'); ?>" value="<?php echo $title; ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo $this -> get_field_id('nav_menu'); ?>"><?php _e('Select Menu:', 'pk_translate'); ?></label>
|
||||
<select class="widefat" id="<?php echo $this -> get_field_id('nav_menu'); ?>" name="<?php echo $this -> get_field_name('nav_menu'); ?>">
|
||||
<?php
|
||||
foreach ($menus as $menu) {
|
||||
|
||||
$selected = $nav_menu == $menu -> term_id ? ' selected="selected"' : '';
|
||||
echo '<option'. $selected .' value="'. $menu -> term_id .'">'. $menu -> name .'</option>';
|
||||
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PK_Widget_Text extends WP_Widget_Text {
|
||||
|
||||
function PK_Widget_Text() {
|
||||
|
||||
$widget_ops = array('description' => __('Arbitrary text, shortcodes or HTML', 'pk_translate'));
|
||||
$control_ops = array('width' => 400, 'height' => 350);
|
||||
$this -> WP_Widget('text', __('Text', 'pk_translate'), $widget_ops, $control_ops);
|
||||
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
extract($args);
|
||||
|
||||
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this -> id_base);
|
||||
$text = apply_filters('widget_text', $instance['text'], $instance);
|
||||
|
||||
echo '<!-- pk start pk-text widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if (!empty($title)) {
|
||||
|
||||
echo $before_title.$title.$after_title;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="textwidget">
|
||||
<?php echo (isset($instance['filter']) && $instance['filter']) ? wpautop($text) : $text; ?>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-text widget -->
|
||||
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
|
||||
do_action('pk_ah_save_text_widget');
|
||||
|
||||
$instance = $old_instance;
|
||||
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
|
||||
if (current_user_can('unfiltered_html')) {
|
||||
|
||||
$instance['text'] = $new_instance['text'];
|
||||
|
||||
} else {
|
||||
|
||||
$instance['text'] = stripslashes(wp_filter_post_kses(addslashes($new_instance['text'])));
|
||||
|
||||
}
|
||||
|
||||
$instance['filter'] = isset($new_instance['filter']);
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
|
||||
$instance = wp_parse_args((array)$instance, array('title' => '', 'text' => ''));
|
||||
$title = strip_tags($instance['title']);
|
||||
$text = esc_textarea($instance['text']);
|
||||
?>
|
||||
<p><label for="<?php echo $this -> get_field_id('title'); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('title'); ?>" name="<?php echo $this -> get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
|
||||
|
||||
<textarea class="widefat" rows="16" cols="20" id="<?php echo $this -> get_field_id('text'); ?>" name="<?php echo $this -> get_field_name('text'); ?>"><?php echo $text; ?></textarea>
|
||||
|
||||
<p><input id="<?php echo $this -> get_field_id('filter'); ?>" name="<?php echo $this -> get_field_name('filter'); ?>" type="checkbox" <?php checked(isset($instance['filter']) ? $instance['filter'] : 0); ?> /> <label for="<?php echo $this -> get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs', 'pk_translate'); ?></label></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PK_Widget_Search extends WP_Widget_Search {
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
extract($args);
|
||||
|
||||
$title = apply_filters('widget_title', $instance['title'], $instance, $this -> id_base);
|
||||
|
||||
echo '<!-- pk start pk-search widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) echo $before_title.$title.$after_title.'
|
||||
';
|
||||
|
||||
get_search_form();
|
||||
|
||||
echo '
|
||||
'.$after_widget.'
|
||||
<!-- pk end pk-search widget -->
|
||||
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PK_Widget_RSS extends WP_Widget_RSS {
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
if (isset($instance['error']) && $instance['error']) return;
|
||||
|
||||
extract($args, EXTR_SKIP);
|
||||
|
||||
$url = $instance['url'];
|
||||
|
||||
while (stristr($url, 'http') != $url) $url = substr($url, 1);
|
||||
|
||||
if (empty($url)) return;
|
||||
|
||||
if ($url == site_url() || $url == home_url()) return;
|
||||
|
||||
$rss = fetch_feed($url);
|
||||
|
||||
$title = $instance['title'];
|
||||
|
||||
$desc = '';
|
||||
|
||||
$link = '';
|
||||
|
||||
if (!is_wp_error($rss)) {
|
||||
|
||||
$desc = esc_attr(strip_tags(@html_entity_decode($rss -> get_description(), ENT_QUOTES, get_option('blog_charset'))));
|
||||
|
||||
if (empty($title)) $title = esc_html(strip_tags($rss -> get_title()));
|
||||
|
||||
$link = esc_url(strip_tags($rss -> get_permalink()));
|
||||
|
||||
while (stristr($link, 'http') != $link) $link = substr($link, 1);
|
||||
|
||||
}
|
||||
|
||||
if (empty($title)) $title = empty($desc) ? __('Unknown Feed', 'pk_translate') : $desc;
|
||||
|
||||
$title = apply_filters('widget_title', $title, $instance, $this -> id_base);
|
||||
|
||||
$url = esc_url(strip_tags($url));
|
||||
|
||||
$icon = includes_url('images/rss.png');
|
||||
|
||||
if ($title) $title = "<a class='rsswidget' href='$url' title='".esc_attr__('Syndicate this content', 'pk_translate')."'><img style='border:0' width='14' height='14' src='$icon' alt='RSS' /></a><a class='rsswidget' href='$link' title='$desc'>$title</a>";
|
||||
|
||||
echo '<!-- pk start pk-rss widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) echo $before_title.$title.$after_title;
|
||||
|
||||
wp_widget_rss_output($rss, $instance);
|
||||
|
||||
echo '
|
||||
'.$after_widget.'
|
||||
<!-- pk end pk-rss widget -->
|
||||
|
||||
';
|
||||
|
||||
if (!is_wp_error($rss)) $rss -> __destruct();
|
||||
|
||||
unset($rss);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PK_Widget_Tag_Cloud extends WP_Widget_Tag_Cloud {
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
extract($args);
|
||||
|
||||
$current_taxonomy = $this -> _get_current_taxonomy($instance);
|
||||
|
||||
if (!empty($instance['title'])) {
|
||||
|
||||
$title = $instance['title'];
|
||||
|
||||
} else {
|
||||
|
||||
if ('post_tag' == $current_taxonomy) {
|
||||
|
||||
$title = __('Tags', 'pk_translate');
|
||||
|
||||
} else {
|
||||
|
||||
$tax = get_taxonomy($current_taxonomy);
|
||||
$title = $tax -> labels -> name;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$title = apply_filters('widget_title', $title, $instance, $this -> id_base);
|
||||
|
||||
echo '<!-- pk start pk-tag-cloud widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) echo $before_title.$title.$after_title;
|
||||
|
||||
echo '
|
||||
<div class="tagcloud">
|
||||
';
|
||||
|
||||
echo str_replace("<a", "\t\t<a", wp_tag_cloud(apply_filters('widget_tag_cloud_args', array('taxonomy' => $current_taxonomy, 'echo' => 0))));
|
||||
|
||||
echo '
|
||||
</div>
|
||||
';
|
||||
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-tag-cloud widget -->
|
||||
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_widgets_overrides() {
|
||||
|
||||
unregister_widget('WP_Widget_Calendar');
|
||||
unregister_widget('WP_Widget_Links');
|
||||
unregister_widget('WP_Widget_Meta');
|
||||
unregister_widget('WP_Widget_Categories');
|
||||
unregister_widget('WP_Widget_Recent_Comments');
|
||||
unregister_widget('WP_Widget_Pages');
|
||||
unregister_widget('WP_Widget_Archives');
|
||||
unregister_widget('WP_Nav_Menu_Widget');
|
||||
unregister_widget('WP_Widget_Text');
|
||||
unregister_widget('WP_Widget_Tag_Cloud');
|
||||
unregister_widget('WP_Widget_RSS');
|
||||
unregister_widget('WP_Widget_Search');
|
||||
|
||||
register_widget('PK_Widget_Calendar');
|
||||
register_widget('PK_Widget_Links');
|
||||
register_widget('PK_Widget_Meta');
|
||||
register_widget('PK_Widget_Categories');
|
||||
register_widget('PK_Widget_Recent_Comments');
|
||||
register_widget('PK_Widget_Pages');
|
||||
register_widget('PK_Widget_Archives');
|
||||
register_widget('PK_Nav_Menu_Widget');
|
||||
register_widget('PK_Widget_Text');
|
||||
register_widget('PK_Widget_Tag_Cloud');
|
||||
register_widget('PK_Widget_RSS');
|
||||
register_widget('PK_Widget_Search');
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', 'pk_widgets_overrides');
|
||||
|
||||
?>
|
@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
class PK_Widget_Popular_Posts extends WP_Widget {
|
||||
|
||||
function PK_Widget_Popular_Posts() {
|
||||
|
||||
$widget_ops = array('classname' => 'widget_popular_posts', 'description' => __('Displays the most popular posts', 'pk_translate'));
|
||||
$this -> WP_Widget('pk-popular-posts', __('Popular Posts', 'pk_translate'), $widget_ops);
|
||||
$this -> alt_option_name = 'widget_popular_posts';
|
||||
|
||||
add_action('save_post', array(&$this, 'flush_widget_cache'));
|
||||
add_action('deleted_post', array(&$this, 'flush_widget_cache'));
|
||||
add_action('switch_theme', array(&$this, 'flush_widget_cache'));
|
||||
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
$cache = wp_cache_get('widget_popular_posts', 'widget');
|
||||
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
|
||||
if (empty($title)) $title = false;
|
||||
|
||||
$number = absint($instance['number']);
|
||||
|
||||
if (!is_array($cache)) {
|
||||
|
||||
$cache = array();
|
||||
|
||||
}
|
||||
|
||||
if (isset($cache[$args['widget_id']])) {
|
||||
|
||||
echo $cache[$args['widget_id']];
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
ob_start();
|
||||
extract($args);
|
||||
|
||||
$r = new WP_Query(array('posts_per_page' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'orderby' => 'comment_count', 'order' => 'DESC'));
|
||||
|
||||
if ($r -> have_posts()) :
|
||||
|
||||
echo '<!-- pk start pk-popular-posts widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) echo $before_title.$title.$after_title;
|
||||
?>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
while ($r -> have_posts()) :
|
||||
|
||||
$r -> the_post();
|
||||
?>
|
||||
<li<?php if (!has_post_thumbnail()) echo ' class="pk_no_thumbnail"'; ?>>
|
||||
<?php if (has_post_thumbnail()) the_post_thumbnail('thumb'); ?>
|
||||
|
||||
<div>
|
||||
<h5><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h5>
|
||||
<?php add_filter('excerpt_length', 'pk_widgets_excerpt_filter'); add_filter('excerpt_more', 'pk_excerpt_more'); the_excerpt(); ?>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
endwhile;
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-popular-posts widget -->
|
||||
|
||||
';
|
||||
|
||||
endif;
|
||||
|
||||
wp_reset_postdata();
|
||||
|
||||
$cache[$args['widget_id']] = ob_get_flush();
|
||||
|
||||
wp_cache_set('widget_popular_posts', $cache, 'widget');
|
||||
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
|
||||
$instance = $old_instance;
|
||||
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
$instance['number'] = (int) $new_instance['number'];
|
||||
|
||||
$this -> flush_widget_cache();
|
||||
|
||||
$alloptions = wp_cache_get('alloptions', 'options');
|
||||
|
||||
if (isset($alloptions['widget_popular_posts'])) {
|
||||
|
||||
delete_option('widget_popular_posts');
|
||||
|
||||
}
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
function flush_widget_cache() {
|
||||
|
||||
wp_cache_delete('widget_popular_posts', 'widget');
|
||||
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
|
||||
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
||||
$number = isset($instance['number']) ? absint($instance['number']) : 5;
|
||||
?>
|
||||
<p><label for="<?php echo $this -> get_field_id('title'); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('title'); ?>" name="<?php echo $this -> get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this -> get_field_id('number'); ?>"><?php _e('Number of posts to show:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('number'); ?>" name="<?php echo $this -> get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_widgets_popular_posts() {
|
||||
|
||||
register_widget('PK_Widget_Popular_Posts');
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', 'pk_widgets_popular_posts');
|
||||
|
||||
?>
|
@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
class PK_Widget_Popular_Works extends WP_Widget {
|
||||
|
||||
function PK_Widget_Popular_Works() {
|
||||
|
||||
$widget_ops = array('classname' => 'widget_popular_works', 'description' => __('Displays the most popular works.', 'pk_translate'));
|
||||
$this -> WP_Widget('pk-popular-works', __('Popular Works', 'pk_translate'), $widget_ops);
|
||||
$this -> alt_option_name = 'widget_popular_works';
|
||||
|
||||
add_action('save_post', array(&$this, 'flush_widget_cache'));
|
||||
add_action('deleted_post', array(&$this, 'flush_widget_cache'));
|
||||
add_action('switch_theme', array(&$this, 'flush_widget_cache'));
|
||||
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
$cache = wp_cache_get('widget_popular_works', 'widget');
|
||||
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
|
||||
if (empty($title)) $title = false;
|
||||
|
||||
$number = absint($instance['number']);
|
||||
|
||||
if (!is_array($cache)) {
|
||||
|
||||
$cache = array();
|
||||
|
||||
}
|
||||
|
||||
if (isset($cache[$args['widget_id']])) {
|
||||
|
||||
echo $cache[$args['widget_id']];
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
ob_start();
|
||||
extract($args);
|
||||
|
||||
$r = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'orderby' => 'comment_count', 'order' => 'DESC'));
|
||||
|
||||
if ($r -> have_posts()) :
|
||||
|
||||
echo '<!-- pk start pk-popular-works widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) echo $before_title.$title.$after_title;
|
||||
?>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
while ($r -> have_posts()) :
|
||||
|
||||
$r -> the_post();
|
||||
?>
|
||||
<li<?php if (!has_post_thumbnail()) echo ' class="pk_no_thumbnail"'; ?>>
|
||||
<?php if (has_post_thumbnail()) the_post_thumbnail('thumb'); ?>
|
||||
|
||||
<div>
|
||||
<h5><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h5>
|
||||
<?php add_filter('excerpt_length', 'pk_widgets_excerpt_filter'); add_filter('excerpt_more', 'pk_excerpt_more'); the_excerpt(); ?>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
endwhile;
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-popular-works widget -->
|
||||
|
||||
';
|
||||
|
||||
endif;
|
||||
|
||||
wp_reset_postdata();
|
||||
|
||||
$cache[$args['widget_id']] = ob_get_flush();
|
||||
|
||||
wp_cache_set('widget_popular_works', $cache, 'widget');
|
||||
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
|
||||
$instance = $old_instance;
|
||||
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
$instance['number'] = (int) $new_instance['number'];
|
||||
|
||||
$this -> flush_widget_cache();
|
||||
|
||||
$alloptions = wp_cache_get('alloptions', 'options');
|
||||
|
||||
if (isset($alloptions['widget_popular_works'])) {
|
||||
|
||||
delete_option('widget_popular_works');
|
||||
|
||||
}
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
function flush_widget_cache() {
|
||||
|
||||
wp_cache_delete('widget_popular_works', 'widget');
|
||||
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
|
||||
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
||||
$number = isset($instance['number']) ? absint($instance['number']) : 5;
|
||||
?>
|
||||
<p><label for="<?php echo $this -> get_field_id('title'); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('title'); ?>" name="<?php echo $this -> get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this -> get_field_id('number'); ?>"><?php _e('Number of works to show:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('number'); ?>" name="<?php echo $this -> get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_widgets_popular_works() {
|
||||
|
||||
register_widget('PK_Widget_Popular_Works');
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', 'pk_widgets_popular_works');
|
||||
|
||||
?>
|
@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
class PK_Widget_Portfolio_Categories extends WP_Widget {
|
||||
|
||||
function PK_Widget_Portfolio_Categories() {
|
||||
|
||||
$widget_ops = array('classname' => 'widget_portfolio_categories', 'description' => __('A list or dropdown of portfolio categories', 'pk_translate'));
|
||||
$this -> WP_Widget('portfolio-categories', __('Portfolio Categories', 'pk_translate'), $widget_ops);
|
||||
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
extract($args);
|
||||
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
$c = $instance['count'] ? '1' : '0';
|
||||
$h = $instance['hierarchical'] ? '1' : '0';
|
||||
$d = $instance['dropdown'] ? '1' : '0';
|
||||
|
||||
echo '<!-- pk start portfolio-categories widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) {
|
||||
|
||||
echo $before_title;
|
||||
echo $title;
|
||||
echo $after_title;
|
||||
|
||||
}
|
||||
|
||||
$taxonomies_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h, 'taxonomy' => 'taxonomy_portfolio', 'echo' => 0);
|
||||
|
||||
if ($d) {
|
||||
|
||||
$terms = get_terms($taxonomy, $taxonomies_args);
|
||||
|
||||
echo '
|
||||
<select id="taxonomy_select_'.$widget_id.'" name="taxonomy_select_'.$widget_id.'" class="postform">';
|
||||
echo '
|
||||
<option value="">'.__('Select Category', 'pk_translate').'</option>';
|
||||
|
||||
foreach ($terms as $term) {
|
||||
|
||||
echo '
|
||||
<option value="'.get_term_link($term -> slug, $taxonomy).'">'.$term -> name.'</option>';
|
||||
|
||||
}
|
||||
|
||||
echo '
|
||||
</select>
|
||||
';
|
||||
?>
|
||||
<script type='text/javascript'>
|
||||
/* <![CDATA[ */
|
||||
document.getElementById("taxonomy_select_<?php echo $widget_id; ?>").onchange = function() {
|
||||
location.href = this.options[this.selectedIndex].value;
|
||||
}
|
||||
/* ]]> */
|
||||
</script>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
$taxonomies_args['title_li'] = '';
|
||||
echo str_replace(array("\n</a>", "\n</li>", "<li"), array("</a>", "</li>", "\t<li"), wp_list_categories(apply_filters('widget_categories_args', $taxonomies_args)));
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
|
||||
echo $after_widget.'
|
||||
<!-- pk end portfolio-categories widget -->
|
||||
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
|
||||
$instance = $old_instance;
|
||||
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
$instance['count'] = !empty($new_instance['count']) ? 1 : 0;
|
||||
$instance['hierarchical'] = !empty($new_instance['hierarchical']) ? 1 : 0;
|
||||
$instance['dropdown'] = !empty($new_instance['dropdown']) ? 1 : 0;
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
|
||||
$instance = wp_parse_args((array) $instance, array('title' => ''));
|
||||
$title = esc_attr($instance['title']);
|
||||
$count = isset($instance['count']) ? (bool) $instance['count'] : false;
|
||||
$hierarchical = isset($instance['hierarchical']) ? (bool) $instance['hierarchical'] : false;
|
||||
$dropdown = isset($instance['dropdown']) ? (bool) $instance['dropdown'] : false;
|
||||
?>
|
||||
<p><label for="<?php echo $this -> get_field_id('title'); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('title'); ?>" name="<?php echo $this -> get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
||||
|
||||
<p><input type="checkbox" class="checkbox" id="<?php echo $this -> get_field_id('dropdown'); ?>" name="<?php echo $this -> get_field_name('dropdown'); ?>"<?php checked($dropdown); ?> />
|
||||
<label for="<?php echo $this -> get_field_id('dropdown'); ?>"><?php _e('Display as dropdown', 'pk_translate'); ?></label><br />
|
||||
<input type="checkbox" class="checkbox" id="<?php echo $this -> get_field_id('count'); ?>" name="<?php echo $this -> get_field_name('count'); ?>"<?php checked($count); ?> />
|
||||
<label for="<?php echo $this -> get_field_id('count'); ?>"><?php _e('Show post counts', 'pk_translate'); ?></label><br />
|
||||
<input type="checkbox" class="checkbox" id="<?php echo $this -> get_field_id('hierarchical', 'pk_translate'); ?>" name="<?php echo $this -> get_field_name('hierarchical'); ?>"<?php checked($hierarchical); ?> />
|
||||
<label for="<?php echo $this -> get_field_id('hierarchical'); ?>"><?php _e('Show hierarchy', 'pk_translate'); ?></label></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_widgets_taxonomies() {
|
||||
|
||||
register_widget('PK_Widget_Portfolio_Categories');
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', 'pk_widgets_taxonomies');
|
||||
|
||||
?>
|
@ -0,0 +1,140 @@
|
||||
<?php
|
||||
|
||||
class PK_Widget_Recent_Posts extends WP_Widget {
|
||||
|
||||
function PK_Widget_Recent_Posts() {
|
||||
|
||||
$widget_ops = array('classname' => 'widget_recent_posts', 'description' => __('Displays the recent posts', 'pk_translate'));
|
||||
$this -> WP_Widget('pk-recent-posts', __('Recent Posts', 'pk_translate'), $widget_ops);
|
||||
$this -> alt_option_name = 'widget_recent_posts';
|
||||
|
||||
add_action('save_post', array(&$this, 'flush_widget_cache'));
|
||||
add_action('deleted_post', array(&$this, 'flush_widget_cache'));
|
||||
add_action('switch_theme', array(&$this, 'flush_widget_cache'));
|
||||
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
$cache = wp_cache_get('widget_recent_posts', 'widget');
|
||||
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
|
||||
if (empty($title)) $title = false;
|
||||
|
||||
$number = absint($instance['number']);
|
||||
|
||||
if (!is_array($cache)) {
|
||||
|
||||
$cache = array();
|
||||
|
||||
}
|
||||
|
||||
if (isset($cache[$args['widget_id']])) {
|
||||
|
||||
echo $cache[$args['widget_id']];
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
ob_start();
|
||||
extract($args);
|
||||
|
||||
$r = new WP_Query(array('posts_per_page' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1));
|
||||
|
||||
if ($r -> have_posts()) :
|
||||
|
||||
echo '<!-- pk start pk-recent-posts widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) echo $before_title.$title.$after_title;
|
||||
?>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
while ($r -> have_posts()) :
|
||||
|
||||
$r -> the_post();
|
||||
?>
|
||||
<li<?php if (!has_post_thumbnail()) echo ' class="pk_no_thumbnail"'; ?>>
|
||||
<?php if (has_post_thumbnail()) the_post_thumbnail('thumb'); ?>
|
||||
|
||||
<div>
|
||||
<h5><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h5>
|
||||
<?php add_filter('excerpt_length', 'pk_widgets_excerpt_filter'); add_filter('excerpt_more', 'pk_excerpt_more'); the_excerpt(); ?>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
endwhile;
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-recent-posts widget -->
|
||||
|
||||
';
|
||||
|
||||
endif;
|
||||
|
||||
wp_reset_postdata();
|
||||
|
||||
$cache[$args['widget_id']] = ob_get_flush();
|
||||
|
||||
wp_cache_set('widget_recent_posts', $cache, 'widget');
|
||||
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
|
||||
$instance = $old_instance;
|
||||
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
$instance['number'] = (int) $new_instance['number'];
|
||||
|
||||
$this -> flush_widget_cache();
|
||||
|
||||
$alloptions = wp_cache_get('alloptions', 'options');
|
||||
|
||||
if (isset($alloptions['widget_recent_posts'])) {
|
||||
|
||||
delete_option('widget_recent_posts');
|
||||
|
||||
}
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
function flush_widget_cache() {
|
||||
|
||||
wp_cache_delete('widget_recent_posts', 'widget');
|
||||
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
|
||||
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
||||
$number = isset($instance['number']) ? absint($instance['number']) : 5;
|
||||
$list_icon = (isset($instance['list_icon']) && !empty($instance['list_icon'])) ? $instance['list_icon'] : '';
|
||||
?>
|
||||
<p><label for="<?php echo $this -> get_field_id('title'); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('title'); ?>" name="<?php echo $this -> get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this -> get_field_id('number'); ?>"><?php _e('Number of posts to show:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('number'); ?>" name="<?php echo $this -> get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_widgets_recent_posts() {
|
||||
|
||||
unregister_widget('WP_Widget_Recent_Posts');
|
||||
register_widget('PK_Widget_Recent_Posts');
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', 'pk_widgets_recent_posts');
|
||||
|
||||
?>
|
@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
class PK_Widget_Recent_Works extends WP_Widget {
|
||||
|
||||
function PK_Widget_Recent_Works() {
|
||||
|
||||
$widget_ops = array('classname' => 'widget_recent_works', 'description' => __('Displays the recent works', 'pk_translate'));
|
||||
$this -> WP_Widget('pk-recent-works', __('Recent Works', 'pk_translate'), $widget_ops);
|
||||
$this -> alt_option_name = 'widget_recent_works';
|
||||
|
||||
add_action('save_post', array(&$this, 'flush_widget_cache'));
|
||||
add_action('deleted_post', array(&$this, 'flush_widget_cache'));
|
||||
add_action('switch_theme', array(&$this, 'flush_widget_cache'));
|
||||
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
$cache = wp_cache_get('widget_recent_works', 'widget');
|
||||
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
|
||||
if (empty($title)) $title = false;
|
||||
|
||||
$number = absint($instance['number']);
|
||||
|
||||
if (!is_array($cache)) {
|
||||
|
||||
$cache = array();
|
||||
|
||||
}
|
||||
|
||||
if (isset($cache[$args['widget_id']])) {
|
||||
|
||||
echo $cache[$args['widget_id']];
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
ob_start();
|
||||
extract($args);
|
||||
|
||||
$r = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1));
|
||||
|
||||
if ($r -> have_posts()) :
|
||||
|
||||
echo '<!-- pk start pk-recent-works widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) echo $before_title.$title.$after_title;
|
||||
?>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
while ($r -> have_posts()) :
|
||||
|
||||
$r -> the_post();
|
||||
?>
|
||||
<li<?php if (!has_post_thumbnail()) echo ' class="pk_no_thumbnail"'; ?>>
|
||||
<?php if (has_post_thumbnail()) the_post_thumbnail('thumb'); ?>
|
||||
|
||||
<div>
|
||||
<h5><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h5>
|
||||
<?php add_filter('excerpt_length', 'pk_widgets_excerpt_filter'); add_filter('excerpt_more', 'pk_excerpt_more'); the_excerpt(); ?>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
endwhile;
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-recent-works widget -->
|
||||
|
||||
';
|
||||
|
||||
endif;
|
||||
|
||||
wp_reset_postdata();
|
||||
|
||||
$cache[$args['widget_id']] = ob_get_flush();
|
||||
|
||||
wp_cache_set('widget_recent_works', $cache, 'widget');
|
||||
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
|
||||
$instance = $old_instance;
|
||||
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
$instance['number'] = (int) $new_instance['number'];
|
||||
|
||||
$this -> flush_widget_cache();
|
||||
|
||||
$alloptions = wp_cache_get('alloptions', 'options');
|
||||
|
||||
if (isset($alloptions['widget_recent_works'])) {
|
||||
|
||||
delete_option('widget_recent_works');
|
||||
|
||||
}
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
function flush_widget_cache() {
|
||||
|
||||
wp_cache_delete('widget_recent_works', 'widget');
|
||||
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
|
||||
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
||||
$number = isset($instance['number']) ? absint($instance['number']) : 5;
|
||||
?>
|
||||
<p><label for="<?php echo $this -> get_field_id('title'); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('title'); ?>" name="<?php echo $this -> get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this -> get_field_id('number'); ?>"><?php _e('Number of works to show:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('number'); ?>" name="<?php echo $this -> get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_widgets_recent_works() {
|
||||
|
||||
register_widget('PK_Widget_Recent_Works');
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', 'pk_widgets_recent_works');
|
||||
|
||||
?>
|
@ -0,0 +1,160 @@
|
||||
<?php
|
||||
|
||||
class PK_Widget_Related_Posts extends WP_Widget {
|
||||
|
||||
function PK_Widget_Related_Posts() {
|
||||
|
||||
$widget_ops = array('classname' => 'widget_related_posts', 'description' => __('Displays the related posts', 'pk_translate'));
|
||||
$this -> WP_Widget('pk-related-posts', __('Related Posts', 'pk_translate'), $widget_ops);
|
||||
$this -> alt_option_name = 'widget_related_posts';
|
||||
|
||||
add_action('save_post', array(&$this, 'flush_widget_cache'));
|
||||
add_action('deleted_post', array(&$this, 'flush_widget_cache'));
|
||||
add_action('switch_theme', array(&$this, 'flush_widget_cache'));
|
||||
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
$cache = wp_cache_get('widget_related_posts', 'widget');
|
||||
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
|
||||
if (empty($title)) $title = false;
|
||||
|
||||
$number = absint($instance['number']);
|
||||
|
||||
if (!is_array($cache)) {
|
||||
|
||||
$cache = array();
|
||||
|
||||
}
|
||||
|
||||
if (isset($cache[$args['widget_id']])) {
|
||||
|
||||
echo $cache[$args['widget_id']];
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
ob_start();
|
||||
extract($args);
|
||||
|
||||
global $post;
|
||||
|
||||
if (isset($post) && $post -> post_type == 'post') {
|
||||
|
||||
$tags = wp_get_post_tags($post -> ID);
|
||||
$tag_ids = array();
|
||||
|
||||
}
|
||||
|
||||
if (isset($tags) && $tags) {
|
||||
|
||||
$tagcount = count($tags);
|
||||
|
||||
for ($i = 0; $i < $tagcount; $i++) {
|
||||
|
||||
$tag_ids[$i] = $tags[$i] -> term_id;
|
||||
|
||||
}
|
||||
|
||||
$r = new WP_Query(array('post_type' => $post -> post_type, 'posts_per_page' => $number, 'tag__in' => $tag_ids, 'post__not_in' => array($post -> ID), 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'orderby' => 'comment_count', 'order' => 'DESC'));
|
||||
|
||||
if ($r -> have_posts()) :
|
||||
|
||||
echo '<!-- pk start pk-related-posts widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) echo $before_title.$title.$after_title;
|
||||
?>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
while ($r -> have_posts()) :
|
||||
|
||||
$r -> the_post();
|
||||
?>
|
||||
<li<?php if (!has_post_thumbnail()) echo ' class="pk_no_thumbnail"'; ?>>
|
||||
<?php if (has_post_thumbnail()) the_post_thumbnail('thumb'); ?>
|
||||
|
||||
<div>
|
||||
<h5><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h5>
|
||||
<?php add_filter('excerpt_length', 'pk_widgets_excerpt_filter'); add_filter('excerpt_more', 'pk_excerpt_more'); the_excerpt(); ?>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
endwhile;
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-related-posts widget -->
|
||||
|
||||
';
|
||||
|
||||
endif;
|
||||
|
||||
wp_reset_postdata();
|
||||
|
||||
$cache[$args['widget_id']] = ob_get_flush();
|
||||
|
||||
wp_cache_set('widget_related_posts', $cache, 'widget');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
|
||||
$instance = $old_instance;
|
||||
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
$instance['number'] = (int) $new_instance['number'];
|
||||
|
||||
$this -> flush_widget_cache();
|
||||
|
||||
$alloptions = wp_cache_get('alloptions', 'options');
|
||||
|
||||
if (isset($alloptions['widget_related_posts'])) {
|
||||
|
||||
delete_option('widget_related_posts');
|
||||
|
||||
}
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
function flush_widget_cache() {
|
||||
|
||||
wp_cache_delete('widget_related_posts', 'widget');
|
||||
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
|
||||
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
||||
$number = isset($instance['number']) ? absint($instance['number']) : 5;
|
||||
$list_icon = (isset($instance['list_icon']) && !empty($instance['list_icon'])) ? $instance['list_icon'] : '';
|
||||
?>
|
||||
<p><label for="<?php echo $this -> get_field_id('title'); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('title'); ?>" name="<?php echo $this -> get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this -> get_field_id('number'); ?>"><?php _e('Number of posts to show:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('number'); ?>" name="<?php echo $this -> get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_widgets_related_posts() {
|
||||
|
||||
register_widget('PK_Widget_Related_Posts');
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', 'pk_widgets_related_posts');
|
||||
|
||||
?>
|
@ -0,0 +1,173 @@
|
||||
<?php
|
||||
|
||||
class PK_Widget_Related_Works extends WP_Widget {
|
||||
|
||||
function PK_Widget_Related_Works() {
|
||||
|
||||
$widget_ops = array('classname' => 'widget_related_works', 'description' => __('Displays the related works', 'pk_translate'));
|
||||
$this -> WP_Widget('pk-related-works', __('Related Works', 'pk_translate'), $widget_ops);
|
||||
$this -> alt_option_name = 'widget_related_works';
|
||||
|
||||
add_action('save_post', array(&$this, 'flush_widget_cache'));
|
||||
add_action('deleted_post', array(&$this, 'flush_widget_cache'));
|
||||
add_action('switch_theme', array(&$this, 'flush_widget_cache'));
|
||||
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
$cache = wp_cache_get('widget_related_works', 'widget');
|
||||
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
|
||||
if (empty($title)) $title = false;
|
||||
|
||||
$number = absint($instance['number']);
|
||||
|
||||
if (!is_array($cache)) {
|
||||
|
||||
$cache = array();
|
||||
|
||||
}
|
||||
|
||||
if (isset($cache[$args['widget_id']])) {
|
||||
|
||||
echo $cache[$args['widget_id']];
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
ob_start();
|
||||
extract($args);
|
||||
|
||||
global $post;
|
||||
|
||||
if (isset($post) && $post -> post_type == 'portfolio') {
|
||||
|
||||
$terms = wp_get_post_terms($post -> ID, 'taxonomy_portfolio');
|
||||
|
||||
$terms_ids = array();
|
||||
$post_in = array();
|
||||
|
||||
}
|
||||
|
||||
if (isset($terms) && $terms) {
|
||||
|
||||
foreach ($terms as $term) {
|
||||
|
||||
$terms_ids[] = $term -> term_id;
|
||||
|
||||
}
|
||||
|
||||
$works_to_query = array_unique(get_objects_in_term($terms_ids, 'taxonomy_portfolio'));
|
||||
|
||||
$total_works_to_query = count($works_to_query);
|
||||
|
||||
for ($i = 0; $i < $total_works_to_query; $i++) {
|
||||
|
||||
if (isset($works_to_query[$i]) && $works_to_query[$i] != $post -> ID) {
|
||||
|
||||
$post_in[] = $works_to_query[$i];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$r = new WP_Query(array('post_type' => $post -> post_type, 'posts_per_page' => $number, 'post__in' => $post_in, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'orderby' => 'comment_count', 'order' => 'DESC'));
|
||||
|
||||
if ($r -> have_posts()) :
|
||||
|
||||
echo '<!-- pk start pk-related-works widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) echo $before_title.$title.$after_title;
|
||||
?>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
while ($r -> have_posts()) :
|
||||
|
||||
$r -> the_post();
|
||||
?>
|
||||
<li<?php if (!has_post_thumbnail()) echo ' class="pk_no_thumbnail"'; ?>>
|
||||
<?php if (has_post_thumbnail()) the_post_thumbnail('thumb'); ?>
|
||||
|
||||
<div>
|
||||
<h5><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h5>
|
||||
<?php add_filter('excerpt_length', 'pk_widgets_excerpt_filter'); add_filter('excerpt_more', 'pk_excerpt_more'); the_excerpt(); ?>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
endwhile;
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-related-works widget -->
|
||||
|
||||
';
|
||||
|
||||
endif;
|
||||
|
||||
wp_reset_postdata();
|
||||
|
||||
$cache[$args['widget_id']] = ob_get_flush();
|
||||
|
||||
wp_cache_set('widget_related_works', $cache, 'widget');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
|
||||
$instance = $old_instance;
|
||||
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
$instance['number'] = (int) $new_instance['number'];
|
||||
|
||||
$this -> flush_widget_cache();
|
||||
|
||||
$alloptions = wp_cache_get('alloptions', 'options');
|
||||
|
||||
if (isset($alloptions['widget_related_works'])) {
|
||||
|
||||
delete_option('widget_related_works');
|
||||
|
||||
}
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
function flush_widget_cache() {
|
||||
|
||||
wp_cache_delete('widget_related_works', 'widget');
|
||||
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
|
||||
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
||||
$number = isset($instance['number']) ? absint($instance['number']) : 5;
|
||||
?>
|
||||
<p><label for="<?php echo $this -> get_field_id('title'); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('title'); ?>" name="<?php echo $this -> get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this -> get_field_id('number'); ?>"><?php _e('Number of works to show:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('number'); ?>" name="<?php echo $this -> get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_widgets_related_works() {
|
||||
|
||||
register_widget('PK_Widget_Related_Works');
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', 'pk_widgets_related_works');
|
||||
|
||||
?>
|
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
class PK_Widget_Sub_Navigation extends WP_Widget {
|
||||
|
||||
function PK_Widget_Sub_Navigation() {
|
||||
|
||||
$widget_ops = array('classname' => 'widget_sub_navigation', 'description' => __('Displays sub navigation', 'pk_translate'));
|
||||
$this -> WP_Widget('pk-sub-navigation',__('Sub Navigation', 'pk_translate'), $widget_ops);
|
||||
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
extract($args);
|
||||
|
||||
global $post;
|
||||
|
||||
if (!isset($post)) return;
|
||||
|
||||
$children = wp_list_pages('echo=0&child_of=' . $post -> ID . '&title_li=');
|
||||
|
||||
if ($children) {
|
||||
|
||||
$parent = $post -> ID;
|
||||
|
||||
} else {
|
||||
|
||||
$parent = $post -> post_parent;
|
||||
|
||||
if (!$parent) {
|
||||
|
||||
$parent = $post -> ID;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$parent_title = get_the_title($parent);
|
||||
|
||||
$title = apply_filters('widget_title', empty($instance['title']) ? $parent_title : $instance['title'], $instance, $this -> id_base);
|
||||
$sortby = empty($instance['sortby']) ? 'menu_order' : $instance['sortby'];
|
||||
$exclude = empty($instance['exclude']) ? '' : $instance['exclude'];
|
||||
|
||||
$output = wp_list_pages(array('title_li' => '', 'echo' => 0, 'child_of' => $parent, 'sort_column' => $sortby, 'exclude' => $exclude, 'depth' => 1));
|
||||
|
||||
if (!empty($output)) {
|
||||
|
||||
echo '<!-- pk start pk-sub-navigation widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) {
|
||||
|
||||
echo $before_title;
|
||||
echo $title;
|
||||
echo $after_title;
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
echo str_replace("<li", "\t\t<li", $output);
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-sub-navigation widget -->
|
||||
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
|
||||
$instance = $old_instance;
|
||||
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
|
||||
if (in_array($new_instance['sortby'], array('post_title', 'menu_order', 'ID'))) {
|
||||
|
||||
$instance['sortby'] = $new_instance['sortby'];
|
||||
|
||||
} else {
|
||||
|
||||
$instance['sortby'] = 'menu_order';
|
||||
|
||||
}
|
||||
|
||||
$instance['exclude'] = strip_tags($new_instance['exclude']);
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
|
||||
$instance = wp_parse_args((array) $instance, array('sortby' => 'menu_order', 'title' => '', 'exclude' => ''));
|
||||
$title = esc_attr($instance['title']);
|
||||
$exclude = esc_attr($instance['exclude']);
|
||||
?>
|
||||
<p><label for="<?php echo $this -> get_field_id('title'); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('title'); ?>" name="<?php echo $this -> get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo $this -> get_field_id('sortby'); ?>"><?php _e('Sort by:', 'pk_translate'); ?></label>
|
||||
<select name="<?php echo $this -> get_field_name('sortby'); ?>" id="<?php echo $this -> get_field_id('sortby'); ?>" class="widefat">
|
||||
<option value="menu_order"<?php selected($instance['sortby'], 'menu_order'); ?>><?php _e('Menu order', 'pk_translate'); ?></option>
|
||||
<option value="post_title"<?php selected($instance['sortby'], 'post_title'); ?>><?php _e('Page title', 'pk_translate'); ?></option>
|
||||
<option value="ID"<?php selected($instance['sortby'], 'ID'); ?>><?php _e('Page ID', 'pk_translate'); ?></option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo $this -> get_field_id('exclude'); ?>"><?php _e('Exclude:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('exclude'); ?>" name="<?php echo $this -> get_field_name('exclude'); ?>" type="text" value="<?php echo $exclude; ?>" />
|
||||
<br /><small><?php _e('Page IDs, separated by commas.' ,'pk_translate'); ?></small>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_widgets_sub_navigation() {
|
||||
|
||||
register_widget('PK_Widget_Sub_Navigation');
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', 'pk_widgets_sub_navigation');
|
@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
class PK_Widget_Testimonials extends WP_Widget {
|
||||
|
||||
function PK_Widget_Testimonials() {
|
||||
|
||||
$widget_ops = array('classname' => 'widget_testimonials', 'description' => __('Displays testimonials', 'pk_translate'));
|
||||
$this -> WP_Widget('pk-testimonials', __('Testimonials', 'pk_translate'), $widget_ops);
|
||||
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
extract($args);
|
||||
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
|
||||
if (empty($title)) $title = false;
|
||||
|
||||
$number = absint($instance['number']);
|
||||
$instance_testimonials_cite = array();
|
||||
$instance_testimonials_quote = array();
|
||||
|
||||
for ($i = 1; $i <= $number; $i++) {
|
||||
|
||||
$testimonials_thumb = 'testimonials_'.$i.'_thumb';
|
||||
$instance_testimonials_thumb[$i] = isset($instance[$testimonials_thumb]) ? $instance[$testimonials_thumb] : '';
|
||||
$testimonials_cite = 'testimonials_'.$i.'_cite';
|
||||
$instance_testimonials_cite[$i] = isset($instance[$testimonials_cite]) ? $instance[$testimonials_cite] : '';
|
||||
$testimonials_quote = 'testimonials_'.$i.'_quote';
|
||||
$instance_testimonials_quote[$i] = isset($instance[$testimonials_quote]) ? $instance[$testimonials_quote] : '';
|
||||
|
||||
}
|
||||
|
||||
echo '<!-- pk start pk-testimonials widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) {
|
||||
|
||||
echo $before_title;
|
||||
echo $title;
|
||||
echo $after_title;
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="pk_testimonials">
|
||||
<ul>
|
||||
<?php
|
||||
for ($i = 1; $i <= $number; $i++) :
|
||||
?>
|
||||
<li<?php if (trim($instance_testimonials_thumb[$i]) == '') echo ' class="pk_no_thumbnail"'; ?>>
|
||||
<?php if (trim($instance_testimonials_thumb[$i]) != '') : ?>
|
||||
<img src="<?php echo trim($instance_testimonials_thumb[$i]); ?>" alt="" />
|
||||
<?php endif; ?>
|
||||
<blockquote>
|
||||
<p><?php echo $instance_testimonials_quote[$i]; ?></p>
|
||||
<cite><?php echo $instance_testimonials_cite[$i];?></cite>
|
||||
</blockquote>
|
||||
</li>
|
||||
<?php
|
||||
endfor;
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-testimonials widget -->
|
||||
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
|
||||
$instance = $old_instance;
|
||||
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
$instance['number'] = $new_instance['number'];
|
||||
for ($i = 1; $i <= absint($instance['number']); $i++) {
|
||||
|
||||
$instance['testimonials_'.$i.'_thumb'] = $new_instance['testimonials_'.$i.'_thumb'];
|
||||
$instance['testimonials_'.$i.'_cite'] = $new_instance['testimonials_'.$i.'_cite'];
|
||||
$instance['testimonials_'.$i.'_quote'] = $new_instance['testimonials_'.$i.'_quote'];
|
||||
|
||||
}
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
|
||||
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
||||
$number = isset($instance['number']) ? absint($instance['number']) : 1;
|
||||
$instance_testimonials_thumb = array();
|
||||
$instance_testimonials_cite = array();
|
||||
$instance_testimonials_quote = array();
|
||||
|
||||
for ($i = 1; $i <= $number; $i++) {
|
||||
|
||||
$testimonials_thumb = 'testimonials_'.$i.'_thumb';
|
||||
$instance_testimonials_thumb[$i] = isset($instance[$testimonials_thumb]) ? $instance[$testimonials_thumb] : '';
|
||||
$testimonials_cite = 'testimonials_'.$i.'_cite';
|
||||
$instance_testimonials_cite[$i] = isset($instance[$testimonials_cite]) ? $instance[$testimonials_cite] : '';
|
||||
$testimonials_quote = 'testimonials_'.$i.'_quote';
|
||||
$instance_testimonials_quote[$i] = isset($instance[$testimonials_quote]) ? $instance[$testimonials_quote] : '';
|
||||
|
||||
}
|
||||
?>
|
||||
<p><label for="<?php echo $this -> get_field_id('title'); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('title'); ?>" name="<?php echo $this -> get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this -> get_field_id('number'); ?>"><?php _e('Number of testimonials to show:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('number'); ?>" name="<?php echo $this -> get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" /></p>
|
||||
|
||||
<div>
|
||||
<?php for ($i = 1; $i <= $number; $i++) : $testimonials_thumb = 'testimonials_'.$i.'_thumb'; $testimonials_cite = 'testimonials_'.$i.'_cite'; $testimonials_quote = 'testimonials_'.$i.'_quote'; ?>
|
||||
<div>
|
||||
<p><strong><?php _e('Testimonial', 'pk_translate'); ?> <?php echo $i; ?>:</strong></p>
|
||||
<p><label for="<?php echo $this -> get_field_id($testimonials_thumb); ?>"><?php _e('Thumbnail URL:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id($testimonials_thumb); ?>" name="<?php echo $this -> get_field_name($testimonials_thumb); ?>" type="text" value="<?php echo $instance_testimonials_thumb[$i]; ?>" /></p>
|
||||
<p><label for="<?php echo $this -> get_field_id($testimonials_cite); ?>"><?php _e('Cite:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id($testimonials_cite); ?>" name="<?php echo $this -> get_field_name($testimonials_cite); ?>" type="text" value="<?php echo $instance_testimonials_cite[$i]; ?>" /></p>
|
||||
<p><label for="<?php echo $this -> get_field_id($testimonials_quote); ?>"><?php _e('Quote:', 'pk_translate'); ?></label>
|
||||
<textarea class="widefat" rows="10" cols="10" id="<?php echo $this -> get_field_id($testimonials_quote); ?>" name="<?php echo $this -> get_field_name($testimonials_quote); ?>"><?php echo $instance_testimonials_quote[$i]; ?></textarea></p>
|
||||
</div>
|
||||
<?php endfor;?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_widgets_testimonials() {
|
||||
|
||||
register_widget('PK_Widget_Testimonials');
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', 'pk_widgets_testimonials');
|
||||
|
||||
?>
|
@ -0,0 +1,182 @@
|
||||
<?php
|
||||
|
||||
class PK_Widget_Twitter extends WP_Widget {
|
||||
|
||||
function PK_Widget_Twitter(){
|
||||
|
||||
$widget_ops = array('classname' => 'widget_twitter', 'description' => __('Display your Twitter updates', 'pk_translate'));
|
||||
$this -> WP_Widget('pk-twitter', __('Twitter', 'pk_translate'), $widget_ops);
|
||||
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
|
||||
extract($args);
|
||||
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
|
||||
if (empty($title)) $title = false;
|
||||
|
||||
$username = (isset($instance['username'])) ? urlencode($instance['username']) : '';
|
||||
|
||||
if (empty($username)) return;
|
||||
|
||||
$number = (isset($instance['number'])) ? absint($instance['number']) : 5;
|
||||
|
||||
$show_follow = ($instance['show_follow'] == 1) ? true : false;
|
||||
|
||||
$total = 0;
|
||||
|
||||
echo '<!-- pk start pk-twitter widget -->
|
||||
'.$before_widget.'
|
||||
';
|
||||
|
||||
if ($title) {
|
||||
|
||||
echo $before_title;
|
||||
echo $title;
|
||||
echo $after_title;
|
||||
|
||||
}
|
||||
|
||||
require_once(ABSPATH.WPINC.'/feed.php');
|
||||
|
||||
$twitter_feed_url = "http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=$username";
|
||||
|
||||
$transients = get_option('pk_twitter_transients');
|
||||
$transients[] = $args['widget_id'];
|
||||
update_option('pk_twitter_transients', array_unique($transients));
|
||||
|
||||
$cache = get_transient($args['widget_id']);
|
||||
|
||||
if ($cache) {
|
||||
|
||||
echo $cache;
|
||||
return;
|
||||
|
||||
} else {
|
||||
|
||||
$feed = fetch_feed($twitter_feed_url);
|
||||
|
||||
}
|
||||
|
||||
if (!is_wp_error($feed)) {
|
||||
|
||||
$total = $feed -> get_item_quantity($number);
|
||||
$items = $feed -> get_items(0, $total);
|
||||
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
if ($total == 0) :
|
||||
|
||||
echo '<p>'.__('The Twitter feed is either empty or unavailable. Please check back later.', 'pk_translate').'</p>';
|
||||
|
||||
else:
|
||||
?>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
foreach ($items as $item) :
|
||||
|
||||
$text = $item -> get_title();
|
||||
$link = $item -> get_permalink();
|
||||
$time = $item -> get_date();
|
||||
|
||||
$text = strstr($text, ': ');
|
||||
$text = substr($text, 2);
|
||||
$text = make_clickable($text);
|
||||
$text = preg_replace_callback('/(^|\s)@(\w+)/', array($this, '_widget_twitter_username'), $text);
|
||||
$text = preg_replace_callback('/(^|\s)#(\w+)/', array($this, '_widget_twitter_hashtag'), $text);
|
||||
|
||||
$time = str_replace(' ', ' ', $time);
|
||||
?>
|
||||
<li><?php echo $text; ?> <small><a href="<?php echo $link; ?>" rel="external nofollow"><?php echo $time; ?></a></small></li>
|
||||
<?php
|
||||
endforeach;
|
||||
|
||||
if ($show_follow) :
|
||||
?>
|
||||
<li><a class="follow" href="http://twitter.com/#!/<?php echo $username ?>"><?php printf(__('Follow @%s on Twitter', 'pk_translate'), $username); ?></a></li>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
echo $after_widget.'
|
||||
<!-- pk end pk-twitter widget -->
|
||||
|
||||
';
|
||||
|
||||
set_transient($args['widget_id'], ob_get_flush(), 3600);
|
||||
|
||||
}
|
||||
|
||||
function update($new_instance, $old_instance) {
|
||||
|
||||
$instance = $old_instance;
|
||||
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
$instance['username'] = $new_instance['username'];
|
||||
$instance['number'] = $new_instance['number'];
|
||||
$instance['show_follow'] = isset($new_instance['show_follow']) ? 1 : 0;
|
||||
|
||||
$transients = get_option('pk_twitter_transients');
|
||||
|
||||
foreach ($transients as $transient) {
|
||||
|
||||
delete_transient($transient);
|
||||
|
||||
}
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
function _widget_twitter_username($matches) {
|
||||
|
||||
return "$matches[1]@<a href='".esc_url('http://twitter.com/'.urlencode($matches[2]))."'>$matches[2]</a>";
|
||||
|
||||
}
|
||||
|
||||
function _widget_twitter_hashtag($matches) {
|
||||
|
||||
return "$matches[1]<a href='".esc_url('http://search.twitter.com/search?q=%23'.urlencode($matches[2]))."'>#$matches[2]</a>";
|
||||
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
|
||||
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
||||
$username = (isset($instance['username'])) ? $instance['username'] : '';
|
||||
$number = (isset($instance['number'])) ? absint($instance['number']) : 5;
|
||||
$show_follow = isset($instance['show_follow']) ? 1 : 0;
|
||||
?>
|
||||
<p><label for="<?php echo $this -> get_field_id('title'); ?>"><?php _e('Title:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('title'); ?>" name="<?php echo $this -> get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this -> get_field_id('username'); ?>"><?php _e('Twitter username:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('username'); ?>" name="<?php echo $this -> get_field_name('username'); ?>" type="text" value="<?php echo $username; ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this -> get_field_id('number'); ?>"><?php _e('Number of tweets to show:', 'pk_translate'); ?></label>
|
||||
<input class="widefat" id="<?php echo $this -> get_field_id('number'); ?>" name="<?php echo $this -> get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" /></p>
|
||||
|
||||
<p><input class="checkbox" type="checkbox" <?php checked($show_follow, true) ?> id="<?php echo $this -> get_field_id('show_follow'); ?>" name="<?php echo $this -> get_field_name('show_follow'); ?>" />
|
||||
<label for="<?php echo $this -> get_field_id('show_follow'); ?>"><?php _e('Show follow link', 'pk_translate'); ?></label></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pk_widgets_twitter() {
|
||||
|
||||
register_widget('PK_Widget_Twitter');
|
||||
|
||||
}
|
||||
|
||||
add_action('widgets_init', 'pk_widgets_twitter');
|
||||
|
||||
?>
|