4 Ways to Loop with WordPress At the heart of the WordPress theme template is the venerable WordPress loop. When you’re looking at your index.php file, for example, the loop is the part that typically begins with if(have_posts()) and contains all the tags and markup used to generate the page. The default loop works perfectly well for most single-loop themes, but for more advanced designs with stuff like multiple and custom loops, more looping power is needed. Fortunately, WordPress provides plenty of flexibility with four ways to loop: Each of these looping methods is useful in a variety of situations. The Default Loop The default WordPress loop looks something like this: <? So what makes it “default”? Based on the query that is sent, the default loop will display a certain number of posts from a certain category from a certain date, and so on. So the default loop is perfect if you’re happy with the query that is sent, but it is also possible to customize the query and generate an entirely different set of posts. <? <? <?
WordPress Video-Tutorial Teil 8: individuelles Logo- und Headerbild In 8. Teil meines WordPress Video-Tutorials zeige ich, wie du ein eigenes Logobild in dein Theme einfügen kannst. Außerdem stelle ich noch die Headerbild-Funktion vor. Mit Hilfe dieser praktischen Funktion können individuelle oder bereits vorbereitete Headerbilder direkt im Adminbereich von WordPress (unter Design/Kopfzeile) hochgeladen und ausgewählt werden. Alle bisherigen Teile des WordPress Video-Tutorials, sowie weitere Screencasts findest du übrigens auch im Album “WordPress Tutorials” auf unserer Vimeo-Seite. Hilfreiche Code-Schnipsel aus dem Video Code der header.php Datei (für Webseiten-Logo, Hauptmenü und Headerbild): Der Code für die Integration der Design/Kopfzeile Option in der functions.php (hier in einer vereinfachten Version nach Vorlage des originalen Codes im TwentyTen-Theme, das Standardbild “ginko.jpg” befindet sich im Ordner images/headers): Weitere Teile des WordPress Video-Tutorials
Class Reference/WP Query Languages: English • Italiano • 한국어 • 日本語 • 中文(简体) • Português do Brasil • (Add your language) Description WP_Query is a class defined in wp-includes/class-wp-query.php that deals with the intricacies of a post's (or page's) request to a WordPress blog. Interacting with WP_Query Most of the time you can find the information you want without actually dealing with the class internals and global variables. There are two main scenarios you might want to use WP_Query in. The second is during The Loop. Note: If you use the_post() with your query, you need to run wp_reset_postdata() afterwards to have Template Tags use the main query's current post again. Note: Ticket #18408 For querying posts in the admin, consider using get_posts() as wp_reset_postdata() might not behave as expected. Usage Standard Loop <? Standard Loop (Alternate) <? Multiple Loops If you have multiple queries, you need to perform multiple loops. Methods and Properties This is the formal documentation of WP_Query. Properties $query or:
The Loop in Action The Loop in Action Languages: English • Español • 日本語 • 中文(简体) • Українська • Русский • (Add your language) Introduction "The Loop" is the main process of WordPress. You use The Loop in your template files to show posts to visitors. You could make templates without The Loop, but you could only display data from one post. Before The Loop goes into action, WordPress verifies that all the files it needs are present. If the user didn't ask for a specific post, category, page, or date, WordPress uses the previously collected default values to determine which posts to prepare for the user. After all this is done, WordPress connects to the database, retrieves the specified information, and stores the results in a variable. By default, if the visitor did not select a specific post, page, category, or date, WordPress uses index.php to display everything. The World's Simplest Index Page The Default Loop Begin The Loop First, it checks whether any posts were discovered with the have_posts() function. <!
Custom CSS You can add custom CSS to your WordPress.com blog using the CSS Editor in the Appearance → Customize → CSS panel in your blog dashboard. Anyone can save and preview custom CSS on a WordPress.com blog even if they have not yet purchased the upgrade. In order to make those changes viewable on the blog’s front-end for everyone, however, you must purchase the Custom Design upgrade which costs $30.00 per blog, per year. CSS stands for Cascading Style Sheets. Making the best of this feature requires some knowledge of how CSS and HTML work, or at least a willingness to learn. Or if you’re looking to get one of the many WordPress.com themes customized and you’re not interested in learning CSS yourself, we recommend hiring a designer to make the changes you need. Frequently Asked Questions Does the Custom Design upgrade let me edit HTML? Does the Custom Design upgrade let me upload themes? May I remove credit links such as ‘Blog at WordPress.com’, theme, font, or toolbar links? I messed up.
Referência própria do wordpress Você encontra este artigo, mais bonito e organizado, e quem sabe até mais atualizado em: Para quem faz uso um pouco mais avançado do WordPress, especialmente quem trabalha desenvolvendo sites com a plataforma, é bem comum aparecerem situações um tanto complexas. Para estas questões, seguem 13 fantásticos comandos SQL para WordPress! Uma maneira prática de executar comandos SQL é através do phpMyAdmin. Os comandos SQL para WordPress a seguir são para o prefixo padrão do WordPress “wp_”. 1. WordPress armazena o caminho absoluto da URL do site (“siteurl”) e URL da home (“homeurl”) no banco de dados. UPDATE wp_options SET option_value = REPLACE(option_value, ' ' WHERE option_name = 'home' OR option_name = 'siteurl'; 2. UPDATE wp_posts SET guid = REPLACE (guid, ' ' 3. 4. 6. 7. 8. 9. 11. 12. 13.
Super Loop: Exclude Specific Categories and Display any Number of Posts Readers occasionally ask for help with their WordPress loops. Usually, these requests involve modifying the loop with some customized functionality. Frequently, such customization involves one of these popular behaviors:Exclude a specific categoryExclude multiple categoriesDisplay only one post or excerptDisplay some fixed number of postsPlay nice with additional loops on the same page In this article, I present the swiss-army knife of WordPress loops. This highly versatile, “super” loop is standard WordPress code, easily implemented, and fully equipped to handle all of the custom behaviors mentioned above. Further, the PHP employed is self-contained, making it ultra-easy to pimp it up tough with your own (X)HTML markup. The Complete Code As is our custom here at Perishable Press, we present the full code offering right up front. The Breakdown Now let’s take a look under the hood, one chunk at a time, and translate the loop to meatspeak: The Throwdown Usage Tweaks Multiple Views Excerpts Only
Category Templates Category Templates When a viewer clicks on a link to one of the Categories on your site, he or she is taken to a page listing the Posts in that particular Category in chronological order, from newest Posts at the top to oldest at the bottom. There are many display choices, including whether to display the complete post or post excerpts, and what additional information to display (title, author, publish date, last modified time, etc.). Each theme makes different choices, and you might want to change them. This article explains how to change what happens when the blog viewer is visiting one of your site's Category pages. Permalinks to category archives are controlled Using Permalinks settings. What Template File is Used? The first step in modifying what happens when someone visits a Category page is to figure out which of your theme's files is going to be used to display the posts. In the case of categories, the hierarchy is fairly simple. Adding Text to Category Pages Static Text Above Posts
Rockin’ out WordPress custom loops — kristarella.com What’s a loop? When using WordPress, “The Loop” refers to the code in your template files that displays posts. Usually there is only one main loop per page, but you can have secondary custom loops to show special content. These can include recent posts and related posts. The loop depends on queries A query is related to the loop in that it determines what should be shown in the loop. Default and custom queries The main query for a WordPress page is determined automatically by the type of page you are viewing (it’s all handled by WordPress). global $query_string; query_posts($query_string . The above code gathers the variable $query_string, which contains all the default query information and then uses query_posts() to create a query with all of the features of the default query, except the attributes that you change. The benefit of using $query_string in this way is that you don’t destroy page pagination on the home and archive pages, which will happen when using query_posts() by itself.
Main Page Using Hooks to Customize Your Pagelines Framework BrandNav So a few months back I decided to become a Pagelines Developer. I had already been using the framework to build custom themes for myself but soon I realized if I wanted to move past some of its styling limitations, I needed to understand exactly how hooks work. For those that don’t know, hooks are small bits of code which you can use to modify or add to a WordPress CMS without editing its core files. It’s a little like creating a child theme in CSS only with PHP. Pagelines is a great framework to work with when theme-ing. Let’s say for example you would like to customize the positioning of your branding elements in the header. This link contains an updated list of all existing hooks for the Pagelines Framework: We can now use our hooks to create the code needed to embed the social icons and and search field. Next, we’ll add the search field by using the ‘pagelines_inside_bottom_brandnav’ hook and create the function ‘new_search’ to call our search field:
10 Exceptional WordPress Hacks Advertisement One of the reasons people love WordPress so much is its great flexibility. You can change the software’s appearance with themes. Today, let’s do it again with 10 new and totally killer WordPress hacks to make your blog stand out from the crowd. You may be interested in the following related posts: 1. The problem. The solution. Code explanation. Using the PHP function file_get_contents(), we can get it and assign it to the $tinyurl variable. Source: How to: Automatically provide TinyURLs for your WordPress blog posts6 2. The problem. The solution. <div id="zukunft"><div id="zukunft_header"><p>Future events</p></div><? Once you’ve saved the file, your upcoming posts will be displayed on your blog. Code explanation. The parameter used is post_status, which allows you to get posts according to their status (published, draft, pending or future). How to: List future posts7 3. The problem. The solution. Code explanation. How to: Add a “Share on Facebook” link to your WordPress blog8 4.
Support Center | Browser Specific CSS The purpose of this tutorial is to give you a good understanding of how to use the Browser Specific CSS Plugin inside of the PageLines framework. Introduction This browser specific css plugin will add a custom body tag depending on what browser/device is viewing the page. Note: This plugin does NOT add css and fix pages for specific browsers, it only adds body classes to help you. Installation The browser specific css plugin can be installed by visiting the PageLines store within your WordPress installation. Install via PageLines Store The easiest and fastest way to install browser specific css is through the PageLines store. PageLines Store Plugins Top Free. Once on the Top Free plugins page, scroll down until you locate the browser specific css plugin and click the install button. Once the store page refreshes, click on the “Your Plugins” tab, scroll to the browser specific css plugin and click the Activate button. WordPress Plugin Installer WordPress Admin Dashboard Plugins Add New