background preloader

Function Reference/query posts

Function Reference/query posts
Languages: English • Italiano • 日本語 • 中文(简体) • Português do Brasil • (Add your language) Description Note: This function isn't meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query of a page by replacing it with new instance of the query. It is inefficient (re-runs SQL queries) and will outright fail in some circumstances (especially often when dealing with posts pagination). Any modern WP code should use more reliable methods, like making use of pre_get_posts hook, for this purpose. query_posts() is a way to alter the main query that WordPress uses to display posts. It should be noted that using this to replace the main query on a page can increase page loading times, in worst case scenarios more than doubling the amount of work needed or more. For general post queries, use WP_Query or get_posts query_posts( 'posts_per_page=5' ); Caveats Usage <?

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

Wordpress Bootstrap Carousel of Posts - Adam Graham Hi all, I have officially made the switch to Bootstrap for my new client work now and it has been a great move (unfortunately it was literally just after I redid this site). With that said I have a handy new bit of code that works great for turning a regular #Wordpress loop into a Bootstrap Carousel. Here is the code I use to make a carousel of posts: <div id="postCarousel" class="carousel slide" data-ride="carousel"> <div class="carousel-inner"> <? If you are familiar with Bootstrap’s carousel this should look pretty straight forward. $i++; if ( $i == 1 ) { echo '<div class="item active">'; } The first thing I set up with the loop is assigning the first post to the “item active” class, this let’s Bootstrap know which slide to start with. The second different thing I do is this: if ( $i % 2 == 0 && $i ! Can you guess what I’m doing here? One thing to note, if you query more than 10 posts just change that ‘if’ statement from “$i ! Next up, add some styling as you like it and you’re good to go.

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:

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.

fr:Widgetiser les Themes fr:Widgetiser les Themes Languages: English • Français • (Add your language) Je suis l'auteur d'un thème. C'est quoi ce courriel me demandant de mettre à jour mon thème ? Vous devriez être heureux qu'ils aiment votre thème suffisamment pour communiquer avec vous plutôt que d'en changer pour des thèmes de quelqu'un d'autre. Bon travail que de rendre les utilisateurs heureux ! D'accord. Vous devez d'abord vous demander : « Est-ce que je sais quelque chose au sujet de mon thème ? Voici un exemple de code d'une bonne barre latérale : <ul id="sidebar"><li id="about"><h2>About</h2><p>This is my blog. Notez que l'ensemble de la barre latérale est une liste non ordonnée et que les titres sont dans les balises <h2>. Les barres latérales proposent quelques fonctions à utiliser dans votre modèle comme des balises de modèles. Voici un exemple d'une mise à niveau de la barre latérale de base en utilisant les mêmes balises que ci-dessus : <ul id="sidebar"><? Vous voyez ? Ça y est, seulement trois lignes.

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.

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

Création Thème Wordpress | Tutoriel #22: CSS: customisation des commentaires Ce tutoriel est le vingt-deuxième d’une série d’articles sur la création d’un thème pour WordPress de A à Z. Si vous prenez le train en cours et si vous souhaitez créer votre propre thème de A à Z, je vous conseille fortement de commencer par le premier tutoriel de la série. Si vous vous souvenez bien, il y a quelques temps, je vous avais demandé d’intégrer un nouveau template (coomments.php) sans trop vous préoccuper du contenu. Aujourd’hui, on va reprendre ce template et je vais vous expliquer les grandes parties à connaître, et qui vous seront utiles pour la customisation des commentaires. Présentation des principaux blocs La partie réservée pour les commentaires est divisée en 2 grandes parties. Expliquons un peu plus dans le détail ces différentes parties: h3#comments, c’est le titre qui va indiquer le nombre de commentaires déjà rédigés. On a déjà un aperçu de ce que sont ces différents blocs et vous pourrez déjà travailler sur ces mêmes blocs pour customiser vos commentaires.

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.

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:

WordPress Channel - Tutoriels, thèmes et plugins WordPress 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

Ajoutez Twitter Bootstrap à votre thème WordPress Ajoutez facilement le look and feel de Bootstrap à votre thème WordPress pour pouvoir utiliser toutes les primitives CSS et JavaScript qu’il propose. Twitter Boostrap ? Twitter Bootstrap est une collection de styles CSS et de scripts JavaScript applicables directement sur les éléments HTML de votre site ou votre blog. De nombreux sites utilisent déjà Bootstrap. Sans trop d’effort, il met en oeuvre un look and feel sympa et actuel. Pour le voir en action, regardez les exemples proposés sur le site. Les fonctionnalités Une des principales fonctionnalités est le découpage d’un espace (la page, le div de contenu, …) en 12 colonnes pour y intégrer du contenu. Pour faire une liste absolument non exhaustive, bien au contraire, il permet de faire des boutons stylisés à partir de liens : inclure des icônes (140 sont disponibles au moment de la rédaction de cet article) : faire des menus : mettre en évidence du contenu : décorer les images : créer des carrousels : Comment ça marche ? en : Le mot de la fin

Related: