How to Set Your Site Icon (Favicon) in WordPress • WPShout

[ad_1] One thing every WordPress site should have is a site icon, also called a “favicon”—the little tiny image that shows up in your browser tabs to let you tell one site from another. Ours at WPShout is a orange circle with a bullhorn inside it, so you which tabs are us. For the more visually-inclined, here’s a relevant summary image of a site icon: Image illustrating a site favicon taken from WordPress itself, because they illustrated it so well ☺️ This video Quick Guide walks you through how to change your WordPress site icon. It’s easier now than ever, because WordPress has embedded this feature right into the Customizer. And WordPress’s standard site icon uploading process has you covered for all the less common uses for favicons (such as serving as retina-ready desktop app icons if someone saves a shortcut to your site onto her iPad homescreen). Here’s my video guide on how to set your site icon in WordPress: And here’s our text guide to the same information: How to Change the Site Icon of Your WordPress Site Collect the image that you’ll use as your site icon (if it’s not already on your WordPress site). Open the Customizer in WordPress. You can click “Customize” along the top bar (if you’re viewing pages on your site), or “Appearance > Customize” in the left-side menu (if you’re in your WordPress admin area). Open the “Site Identity” panel by clicking it from the initial listing panel. Open the “Site Icon” section. If it hasn’t been used before on your site you’ll click the “Select Image” button. There you will select an image already in your image library, or have the ability to upload a new one. (If you’ve ever used WordPress’s media library, this screen should be familiar.) You will have the ability to crop the image. If it was square, you’ll probably skip this by clicking “Crop Image” without resizing the selection box. (If you do need to crop, drag away.) With that, you’ll be set. Your browser tab may immediately update with the image. If it doesn’t, but you see something like this, you’re set: (Browser caching can be hard to debug, but refresh may fix it for you.) 🙂 And that’s how to change your WordPress site icon! Streamlining this process has been one of the default Customizer’s sweetest features. Let us know if you have any questions—we’re happy to help. [ad_2] Source link

Continue reading

A Journey toward Freedom with WordPress – वर्डप्रेससंगै स्वतन्त्रता तर्फको यात्रामा

[ad_1] यो लेख नेपाली भाषामा पनि उपलब्ध छ। Hello world! “Always be thankful for what you have, many people have nothing!” – Buddha Yes, I’m immensely grateful to be writing this essay! I’m fortunate to have had the education that gave me the capacity to aspire, get into a WordPress job, meet people from around the world, connect with Topher of HeroPress, and tell my story! How I Landed Into a WordPress Job My WordPress journey began by chance! Honestly, I didn’t know WordPress until I landed on a WordPress job. Back then, I was doing my Master’s degree in Sociology and had just left my work as a school teacher. I was looking for a job that would allow me to focus on my study and pay me a decent salary. I had a long career of over 5 years in teaching which was a full-time job. In addition to 9 AM to 5 PM work, we had to work extra hours at home – designing lesson plans, evaluating assignment works, exams, etc. – so I was finding it hard to manage time for my own study. I just needed a job that wouldn’t require me to work after office hours. After applying to several different positions, I finally got a content writing job. Fortunately, the company turned out to be a successful WordPress development company based in Nepal (Access Keys). Well, it’s how my WordPress story began! But it’s not the full story. For Hope! My Family’s Struggle for Education I come from a remote village in the hills of Nepal, not connected by any means of transportation until recently. We had to walk a minimum of an hour to go to the nearest school, from where I completed my secondary education. But that time wasn’t just about walking hours to reach school. It was also about poverty, hardships, and the burning desire to overcome them someday! Schools were first opened in the late 1970s in our village but my parents couldn’t even complete the lower secondary level. Pervasive poverty and lack of awareness both were responsible for it. Time passed but our family’s financial condition was still the same. But my parents had understood that the only way out of it was education. Hence, they decided to send us to school, no matter what. Our father sometimes as a seasonal migrant worker to India, sometimes as a porter, brought us (me and my siblings) school supplies. Our mother worked day and night, managed home, family, and our farm. After completing secondary level education, I moved to a nearby city in the guardianship of my aunt. With minimal financial support from my parents, my aunt helped me complete higher secondary school. However, she had her own hardships. She was a single mother without any academic degree so had to work minimum-wage jobs which hardly met her and her family’s needs. Therefore, I couldn’t simply add to her burden. And on the other side, my parents had to support my younger siblings too. So, the only choice I had, if I wanted to study further, was to support myself, for which I started teaching in a school. Breakthrough through English Language Skills I got my life’s first job but it wasn’t easy. I joined a private English-medium school as a teacher. But my schooling as well as the undergraduate program had been in our national language, Nepali, and not in English. We had “English” as a subject in school but the teacher taught us English in the Nepali language. We never spoke in English. Yet, my English writing was fine as I was a good student. When I joined an English medium school as a teacher, I had no choice but to improve my English. I practiced speaking English with primary-level students. Within a year, my spoken English improved considerably. Along with my teaching job, I continued my college. It was a super-busy schedule but was the only option I had! With my earnings, I paid my college fees, covered some of my living expenses, and also supported my family. Well, this is how I completed my Bachelor’s degree and started my Master’s degree too. Later on, the same teaching job that I started to sustain myself enabled me to apply for an English content writing job! As of now, I’m quite confident about my English language skills but still feel hesitant when I have to talk with native speakers. My WordPress Journey – Toward Freedom As I stated earlier, I landed on my first WordPress job when I was looking for the type of job that would allow me free time for my study. Yes, and that’s from where my journey toward freedom began! During my interview, I explained to the CEO of Access Keys (Arjun Singh Thakuri) about the flexibility that I need in my new job so that I could also focus well on my studies. I was hired and could join from 11 AM instead of the usual 9:30 AM after attending my classes in the morning. It was a moment of gratitude and great relief for me! I learnt WordPress at Access Keys. First, by reading Wikipedia and other blogs on the web. Second, from Arjun sir as well as from the senior developers and the designers at the company. I used to have a lot of questions, and my team at Access Keys helped me get answers to those questions. Third, by doing. I set up a WordPress.com blog, a testing site on localhost, and tried different options. My curiosity was definitely the driving force, but above all, ‘the way WordPress is built’ is what made it possible for someone like me (with no technical background) to understand a powerful website creation software, WordPress. As for content writing skills, I started with list articles (theme collections). Arjun sir mentored me for my first few articles. Later, Access Keys hired an experienced SEO professional Amin Ghale who taught me more about SEO and

Continue reading

Custom User Avatar Plugins for WordPress – WordPress Tavern

[ad_1] You know what one of the great things about open source is? Others can use a project’s code, share it wholesale, modify it, and/or distribute their changes. These are the pillars upon which WordPress stands. It is a beautiful thing to watch in practice. Most often, it means we can build off the shoulders of those giants who came before us, continually improving the software for ourselves and others. It is how WordPress got its start nearly two decades ago as a fork of the b2/cafelog blogging system. Sometimes, it just means having the freedom to give your friend a copy of something you love and letting them use it. Other times, it is the gateway for a budding developer learning how functions or classes work for the first time, ripping apart a project to see what makes it tick. Every so often, the promise of free software means that others can decide to go their own way when they do not like the direction a project is heading. They can fork the code, carving a new destination for its future. This is what happened when ProfilePress overhauled its WP User Avatar plugin, turning it into a full-fledged membership solution. While its average user may not be able or willing to dip their toes into the depths of the development waters, when you have a 400,000+ user base, a few of them are bound to be programmers. Or at least tech-savvy enough to create a copy of the previous version and distribute it directly. It did not take long — mere days — before ex-users began sharing their forks. The beauty of open source is that they have the power to do this without some corporation cracking down on them. I wanted to acknowledge what they accomplished by jumping into a messy situation and making quick alternatives for many users who felt abandoned. This is my symbolic handclap. 👏 It is not often that we get to mention WordPress’s license without gearing up for battle. However, the GPL played a crucial role in making these forks possible. The license protected the plugin’s user base, giving them multiple alternative paths to take. Without further preaching the merits of open source, the following are the current forks of WP User Avatar: One User Avatar by Daniel Tara (One Designs). It already has nine translations and is available on WordPress.org. Custom User Avatar by David Artiss. It is currently available on GitHub, but it appears he plans to add it to the plugin directory. Orig User Avatar by Philipp Stracker. This one is also only available on GitHub. Each fork looks like a straight port of the latest version of WP User Avatar before version 3.0. There are some necessary code and branding changes. The first two also remove all advertising from the plugin. For anyone looking to return to the exact same functionality as the old plugin, any one of these will do the job. Alternative Solutions Straight ports are nice to have, especially for those who need to keep their data intact for many user accounts, but this could also be an opportunity for others to look at alternatives. And, custom user avatar solutions are a dime a dozen. There is a little something for everyone out there. The following is nowhere near a comprehensive list. I have either tested or used most of these in the past couple of years. I encourage anyone to share plugins I did not include in the comments. Simple Local Avatars Topping any list of custom avatar solutions is Simple Local Avatars by 10up. The WordPress company is one of the most respected in the community, and its employees contribute heavily to core development. 10up tends to put together solid plugins. Simple Local Avatars does just what it says on the box. It allows users to upload custom avatars to their site. It also generates requested image sizes on demand. It works alongside Gravatar, a feature that can be enabled or disabled. It also has built-in options for site administrators to grant permission to non-authorized roles to upload their photos. WP User Avatars WP User Avatars by John James Jacoby, a lead developer for bbPress and BuddyPress, is another simple plugin. Like many similar solutions, it adds a form for users to manage their avatar from their profile pages. It is unique in that it works alongside a suite of other user-related plugins that Jacoby offers. While it can work on its own, it is at least worth checking out his WP User Profiles plugin, which overhauls WordPress profile pages. It and his other user-related plugins work in conjunction with each other. Plugin users can pick and choose which they wish to install. User Profile Picture There seems to be a pattern emerging here — users tend to love these simple avatar solutions. User Profile Picture by Cozmoslabs is another that fits this mold. It also includes a block to allow post or page authors to output any user’s profile (avatar, name, description, and posts link) on the site front end. Users without permission to upload an image cannot add an avatar with this plugin alone. By default, this is the Administrator, Editor, and Author roles. Site admins will need to install either a permissions plugin or Cozmoslabs’ Profile Builder for the extra capability. Pixel Avatars (Toolbelt) Pixel Avatars is a privacy-first Gravatar replacement. It takes a different route than similar options by not providing a method to upload a custom avatar. Instead, it automatically generates unique avatars for each user with a bit of JavaScript. It is a fun twist on the typical avatar system. Technically, this is not a standalone avatar plugin. The Pixel Avatars system is a sub-component of the Toolbelt plugin. Created by Ben Gillbanks, it is a collection of tools that he uses for most of his WordPress projects. It may be overkill for many, but each plugin module can be enabled or disabled based on user needs.

Continue reading

Sort WordPress Posts By Date

[ad_1] TL;DR: If you’re looking for an easy way to sort WordPress posts by date (be it descending or ascending) in the administration area without having users click on the Date column header, you can do so through the use of the pre_get_posts filter that provides a reference to the instance WP_Query running on the page. For examples in code on how to do that, check out the rest of the article. Sort WordPress Posts This article is written such that it assumes your set up in class-based. This means that the set up for the filter is defined in a function such as init and it invokes a public function name on the class such as sort_articles_by_recent_time. Finally, it defines a priority of 10 and specifies the function will accept a single arguments (which is an instance of WP_Query. First, add the following filter: add_action( ‘pre_get_posts’, [ $this, ‘sort_articles_by_recent_time’ ], 10, 1 ); Then add the following function: public function sort_articles_by_recent_time( WP_Query $query ) { global $pagenow; if ( ! is_admin() || ‘edit.php’ !== $pagenow ) { return; } $query->set( ‘orderby’, ‘date’ ); $query->set( ‘order’, ‘desc’ ); } Here’s how it works: Note the first conditional checks if we’re not in the administration area or if we’re not on the edit.php page (which is the post listing page), we simply leave the functionality. This is a guard clause or an early return. If we meet both of those criterias, then we’ll update the query so that it orders to posts by date in descending order. This means the most recent dates will always be listed at the top. This does not account of post status (so if it’s a draft or a post with the publish status then it won’t matter). Further, this will prevent users from having to click on the Date column header to sort the results as needed if this is something you so desire in your solution. References [ad_2] Source link

Continue reading

Delicious Brains Acquires Advanced Custom Fields Plugin – WordPress Tavern

[ad_1] Delicious Brains, the company behind WP Migrate DB Pro and SpinupWP, has acquired the Advanced Custom Fields (ACF) plugin from its creator, Elliot Condon. After 10 years, the plugin has more than 1 million active installs and a thriving business based on the Pro version. It has become an indispensable part of the workflow for thousands of WordPress developers around the globe. The plugin allows developers to easily customize WordPress edit screens and custom field data. In 2019, the Pro version introduced ACF Blocks, a PHP-based framework for developing custom blocks. This came as a great relief to many developers who did not know how they were going to keep pace with learning the JavaScript required to use WordPress’ Block API. General reaction to the news was positive, as ACF fits in neatly with Delicious Brains’ suite of well-maintained developer products. The company’s founders also possess a genuine appreciation of ACF and its importance to the WordPress developer community. “I don’t think WordPress would be where it is today without ACF,” Brad Touesnard said on a recent episode of the Delicious Brain Waves podcast. Condon cited the scale of the project and “technology complexity and user expectation” as factors in his decision to sell ACF. As a one-person team, he was unable to keep up with the growth of ACF over the years. “Stepping away from ACF has not been an easy decision to make,” Condon said. “The reasoning behind it comes from a place of humility. As the number of installs have grown from thousands to millions, the needs of the product have outgrown my ability to develop solutions. The last thing I want to do to this amazing community is unintentionally hold back the project, so something needed to change.” Delicious Brains’ announcement stated that the company will be reviewing Condon’s roadmap for the product in hopes of fulfilling his vision moving forward. “Two of our greatest strengths that we’ll bring to ACF are design (UI/UX) and developer education,” Touesnard said. “We’ll be focusing our initial efforts in those areas. I have a few UI/UX improvements in mind that would make a huge difference to users. We also see a significant opportunity to produce developer-focused content focused on effectively using ACF in your WordPress projects.” Touesnard also confirmed that Delicious Brains will not be making any drastic changes to ACF or ACF Pro, nor do they plan to adjust the pricing of the product anytime soon. “If we ever decide to update pricing in the future, we won’t force existing customers onto the new pricing,” he said. After the initial announcement, there was some confusion surrounding lifetime licenses that originated from a hasty response to a customer inquiry. Delicious Brains has since updated the post to clarify the company’s commitment to ACF Pro’s lifetime customers. “We are committed to honoring lifetime licenses forever,” Touesnard said. “Lifetime license holders will get all ACF Pro software updates forever.” More information on how the acquisition happened, as well as what customers can expect in the future, is available on the most recent episode of the Delicious Brain Waves podcast. Like this: Like Loading… [ad_2] Source link

Continue reading

WordPress Theme Development: Core Concepts (Full Guide)

[ad_1] Welcome! WordPress themes are one of the most important topics that one must understand to be good at WordPress development. Themes underlie the entire visual half of WordPress sites, but often grow to do even more. Because of the visual importance, they’re a great place to dive in if you’re interested in getting to the “code-side” of WordPress. I myself “cut my teeth” on WordPress themes back in 2007 and 2008. WordPress themes were where I started to come to grips with the power (and limits) of PHP, CSS, and HTML. So this course is great for newbies, and those just looking to confirm their understanding of the whole system. An editor’s note before we dive in: 2021 is an exciting year for the future of WordPress themes. For the first time since… kind of forever (that is: the start of WordPress itself)… what themes look like could change pretty dramatically. But today, in April 2021, that future is still a little unclear. And even when that future is clearer (and less likely to change) it’ll still be vital that WordPress developers understand “classic” WordPress themes for a long time. After all, as seasoned WordPress freelancers are well aware, WordPress sites can live for a long time with little more than security updates. So we’ve updated our classic and still vital little free course on WordPress themes as they are in early-2021. Enjoy! Understanding this Free WP Theme Development Course This is an brief introduction to the core concepts of WordPress theme development and comes from the Third Edition of our “learn WordPress development” course Up and Running. We’ve worked hard over the years to write some of the best tutorials on WordPress development, and give them away to readers here at WPShout. Up and Running is our effort to consolidate all that teaching into a single step-by-step resource for people new to the world of WordPress coding. Hopefully, it’s also a little easier to navigate than the mess of links that is this (or any) modern website. This post consolidates a few of that chapters from Up and Running together. While the course is much more exhaustive on both WordPress theme and plugin development than this is, we’re sure this will give you a very solid foundation to start from. The three important concepts of WordPress theme development we’ll cover here are: The WordPress Template Hierarchy Processing Posts with The Loop Adding Functionality with functions.php We’ll take you through each one on the linked articles at the bottom of every section. Those are a very accurate representation of what you’d find in Up and Running. Although on the real course site, it’s a little easier to keep your place. We have a completion-tracking WordPress plugin for that 🤓. Like you’ll find in Up and Running, all of the linked chapters here have a Summary Limerick and Quiz to reinforce what you’ve learned at their end. 🙃 Core Concept 1 of WordPress Theme Development: The Template Hierarchy The first thing that’ll help you get a sense of WordPress theme development is getting a sense of what all those theme files do. Some of them may be obvious to someone who has done a fair amount of web development, like style.css being the place for your CSS styling rules. But most the work you do in WordPress theme development comes down to understanding the WordPress template hierarchy. WordPress template hierarchy underlies a lot of what’s useful and complicated about WordPress. WordPress themes involve a bunch files. And understanding those files is the key to understanding WordPress development. All the files in the template hierarchy have a few things in common: They have names that end with .php They contain a version of “the Loop” inside of them (see the next section for more about that) They mostly contain HTML and some PHP code Those three bullet points are the core of what makes up the WordPress hierarchy. But there’s a lot more to understand. And that’s what our article all about it tries to help you with. Reading it will get you along the way to being a full-fledged WordPress theme developer: The Template Hierarchy in WordPress Core Concept 2 of WordPress Theme Development: The Loop in WordPress and What it Means For this one, we’ve taken the time to create a custom post. Like the other of these post’s, this is a chapter from Up and Running. The Loop is one of the things that first scared me (David writing this) about WordPress development. The core thing was that it all sounded so ominous. Whether people called it “WordPress loop” of “The Loop”, I knew that WordPress had that complicated concept involved. Later, after I’d programmed more, I realized that this was just a basic “while” loop, a common construct in almost all programs. But before that, it really intimidated me. If you feel like you’ve got it from that description alone, you might not need to read our full article about what the WordPress Loop is and what it means. Other than the syntax which is distinct to WordPress, it’s not much more complicated than that. But if you’ve never done much coding, you probably should be sure to read the whole article. WordPress theme development is really dependent on getting a handle on how “the Loop” works in WordPress. You’ll hear people talk a lot, as you get into theming, about being “inside the WordPress loop” and outside of it. The article covers all of that and more. If you’ve not read it yet, please do: Understanding The Loop: WordPress’s Way of Showing Posts Core Concept 3 of WordPress Theme Development: Adding Functionality with functions.php Plugins are a big topic in WordPress, and I’ve sometimes heard people describe this next focus as “the plugin of a WordPress theme.” I don’t necessarily agree with that description. I also think it actually add confusion to the issue. That said, inside of your WordPress theme’s functions.php is indeed where you write

Continue reading

WordPress – The Source Of My Satisfaction And Joy – વર્ડપ્રેસ – સંતોષ અને આનંદ નો સાધન

[ad_1] આ નિબંધ ગુજરાતીમાં પણ ઉપલબ્ધ છે My adventure with WordPress started back in the year 2017. Till then there were many ups and downs and I was clueless which field I will enter into. Right until the end of 2016, I was giving my exams to become a Chartered Accountant (CA) equivalent to CPA. I also love baking cakes and pastries. So, in the first half of 2017, I had started a small homegrown bakery for making donuts. It was interesting but it didn’t give me a sense of satisfaction. I also hosted some small exhibitions of fabrics and fashion apparels. In short, I tried many different fields but I still wasn’t happy from within. So, after giving up on CA (for which I spent a few years) and trying out hands on baking I still did not have the sense of satisfaction and wanted to do something that would give me an identity of myself and happiness. One casual day, my husband Dhruvin asked me to get involve with WordPress in some way or the other. But, I wasn’t sure whether I would get a place in the technical world or not. This was a completely different challenge for me. Introduction to WordPress After giving a serious thought I decided to get started with WordPress. I spent the initial 6-8 months exploring WordPress, learning the basics about the Web, making myself comfortable with it & deciding if this is something I would love to work on or not. I then participated in WordCamp Mumbai 2018. That was one of the few WordCamps I have attended. This WordCamp gave me enough confidence that WordPress is the new sky for me where there is no limit. Finding the perfect role in WordPress Now, that I got familiar with WordPress, the next question for me was what kind of role or a job I would best fit into? I started interacting with a few people in WordCamp (which I miss very badly these days), I understood that I like interacting and engaging with people a lot. So, I thought that the Customer Support role would fit perfectly with my personality. Once I was convinced about this, I got an opportunity to work with Tyche Softwares. They are a plugin development company focussing on niche WooCommerce plugins. This was the first step of my professional journey in WordPress, something that I never imagined I would step into. I started enjoying it more as I would gain immense satisfaction when I helped customers solve their problems. I also tried my hand at the Business Development and Analytics part. I used to analyze customer feedback. The analysis involves creating the processes to improve the customer satisfaction and looking at how to automate a certain task using the tools at our hand. These things help in taking some important decisions on companies’ plugins with regards to new features. About WordCamps I love attending WordCamps. I began attending WordCamps in 2018 and my very first WordCamp was WC Mumbai 2018. Since then, I’ve been going to as many as would fit in my schedule every year. I learn something new at every WordCamp, we deepen existing relationships and start new ones. My first major Wordcamp was WCEU 2019 held in Berlin. It was a memorable one which will be in my mind for ages. I realized that it’s so much fun getting to meet people in real life whom you have only known on social media. WordCamps have also been a great chance for me to learn from others and collaborate on ideas surrounding WordPress. WordCamps have also been a great opportunity for me to travel and/or meet up with old friends, and make new ones. Of course, I also love the learning aspect of WordCamps. I look forward to learning new things and to speakers challenging my way of thinking, and seeing if there are ways I can improve my workflow or productivity or as a person. The WordPress community has taught me that it’s ok if I don’t know everything, nobody does. We are all good at certain things and that’s totally fine! The other memorable WordCamp for me was WordCamp Vadodara that happened in October 2019. I applied as a volunteer & the organizing team was kind enough to give me that opportunity. That entire day, I was taking video bytes of the attendees, helping with registrations, and running around just trying to talk to as many people as I could. I barely got time for my lunch or time to spend time at the Tyche sponsors booth. Trust me, at the end of the day, I felt like I am just made for this! I enjoyed every bit of this experience. After volunteering a few more WordCamps, I applied to volunteer at the first-ever WordCamp Asia, which was to be held in Feb 2020 & my application was accepted as well. Unfortunately, COVID-19 struck just at that time & the event couldn’t take place. I am definitely looking forward to helping the community in all the ways I can. What I do in my free time I love traveling and meeting new people. The idea of travel, packing my bags and disappearing to someplace, lives inside my brain all the time. Whenever I meet someone for the first time or even encounter an old friend, I instantly want to talk about their own adventures. As a kid I was always curious about the lifestyle of people living in the other part of the world. Till date, I love exploring such things. I deeply believe travel makes you richer, not in your wallet, but in your intelligence and compassion. I also love dancing, cooking new dishes and spending time on social media. I love watching cartoons too 😉 Time to take a break The year 2020 has been a year full of surprises. Virus, lockdowns, travel restrictions to many such things. Through all these things was a moment of joy for me

Continue reading

Building Featured Boxes With the WordPress Block Editor – WordPress Tavern

[ad_1] It is a new day with another chase for that elusive block plugin that will bring a little joy into my life. Today’s experiment comes courtesy of the Feature Box plugin by Sumaiya Siddika. It is a simple block that allows end-users to upload an image and add some content to an offset box. The plugin’s output is a typical pattern on the web. As usual, I am excited to see plugin authors experimenting with bringing these features to WordPress users. I want to see more of it, especially from first-time plugin contributors. I was able to quickly get the block up and running, adding my custom content. The following is what the block looked like after entering my content and customizing it. I envisioned myself as a recipe blogger for this test. Inserting and modifying the Feature Box block. On a technical level, the plugin worked well. I ran into no errors. Everything was simple to customize. However, it never felt like an ideal user experience. The first thing I immediately noticed is that image uploading happens in the block options sidebar. Core WordPress blocks have a dedicated button in the toolbar for adding images and other media. I also found myself wanting more direct control over individual elements. How could I change the heading font size? Where were the typical button styles like Outline and Solid Color? How do I insert other blocks, like a list? None of those things were possible. Like many other blocks, the developer has created a system with specific parameters, and the user cannot move outside of them. There are times when that rigidity makes sense, such as when building custom blocks for clients. However, more often than not, publicly-released plugins should be far more open. This tightly controlled block is reflective of how WordPress worked in the past. It was often inflexible, leaving users to what theme and plugin developers thought was best for their sites. The block system is about tossing out these overly rigid concepts and giving users power over their content. The job of plugins and themes is to define the framework the user is operating under. They set up some rules to more or less keep things from breaking, but the users get to strap themselves into the driver’s seat. Their destination is their own. The block would have been far more well-rounded if users could control all of the content in the box. Ideally, they could put whatever blocks they wanted into the “content” area of the Feature Box block. The design would match their theme better too. A couple of weeks ago, I wrote a post titled You Might Not Need That Block. The premise was that users could recreate some blocks with the current editor and that themers could make this easier by offering patterns. I knew replicating this particular block would be impossible without at least a little custom code. WordPress’s editor does not have a feature for offsetting a block’s position. A theme author could easily duplicate this functionality. Typically, I would create a custom pattern, complete with all the existing pieces in place. However, I wanted to approach this with custom block styles. This would allow end-users to select the content offset from the sidebar and switch it around if needed. Note: For those who wish to learn how to create custom block styles, Carolina Nymark’s tutorial is the best resource. The Cover block made an ideal candidate for this. Because it has an existing “inner wrapper” element, it meant that I could target it with CSS and move it around. The following is a screenshot of the Offset Left style I created: Offset Left Cover block style. I simply replicated the code and changed a few values to create an Offset Right style immediately after. The code is available as a GitHub Gist. It is a simple proof-of-concept and not a polished product. There are various approaches to this, and several Cover block options are left unhandled. Theme authors are free to take the code and run with it. These block styles looked far better because they matched my theme. Everything from the spacing to the border-radius to the button looked as it should. Offset Left and Right block styles. The big win was that I had design control over every aspect of the content box. I could select the button style I wanted. I could change my font sizes. The default spacing matched my theme as it should. The problem I ran into with the block style method is allowing users to control the content box’s background color. The Feature Box plugin wins in the user experience category here because it has an option for this. The block style I created inherits its background from the Cover block parent. It may not be immediately obvious how to change it. The other “problem” with the block style is that it does not handle wide and full alignments for the Cover block. That is because I did not take the experiment that far, only replicating the plugin’s layout. I will leave that to theme designers to tinker around with. There are many possibilities to explore; don’t wait for me to provide all the ideas. My goal with this post and similar ones is to show how I would approach these things as both a user and developer. As a user, I want flexibility in all things. As a developer, I want to provide the solutions that I desire as a user. I also want to see plugin and theme authors thinking beyond their initial use case when building blocks, patterns, styles, and more. Lay the groundwork. Then, expand on that initial idea by thinking of all the ways that users might want to customize what you have built. Like this: Like Loading… [ad_2] Source link

Continue reading

Create Per-Post Social Media Images With the Social Image Generator WordPress Plugin – WordPress Tavern

[ad_1] It was a bit of a low-key announcement when Daniel Post introduced Social Image Generator to the world in February via tweet. But, when you get repped by Chris Coyier of CSS-Tricks and the co-founder of WordPress uses your plugin (come on, Matt, set a default image), it means your product is on the right track. I am not easily impressed by every new plugin to fly across my metaphorical desk. I probably install at least a couple dozen every week. Sometimes, I do so because something looks handy on the surface, and I want to see if I can find some use for it. Other times, I think it might be worth sharing with Tavern readers. More often than not, I consider most of them cringeworthy. I have high standards. As I chatted with Post about this new plugin, I was excited enough to call Social Image Generator one of those OMG-where-have-you-been? types of plugins. You will not hear that from me often. Post quit his day job to venture out earlier this year, creating his one-man WordPress agency named Posty Studio. Social Image Generator is its first product. “I kept seeing tutorials on my Twitter feed on how to automatically generate images for your social media posts, but unfortunately, they all used a similar approach (Node.js) that just wasn’t suitable for WordPress,” said Post of the inspiration for the plugin. “This got me thinking: would it be possible to make this for WordPress? I started playing around with image generation in PHP, and when I got my proof of concept working, I realized that this might actually be something I should pursue.” In our chat over Slack, we actually saw the plugin in action. As he shared Coyier’s article from CSS-Tricks, the chatting platform displayed the social image in real-time. Auto-generated image appearing via Slack. Maybe it was fate. Maybe Post knew it would happen and thought it would be a good idea to show off his work as we talked about his project. Either way, it was enough to impress the writer who is unafraid to call your plugin a dumpster fire if he smells smoke. Post seems to be hitting all the right notes with this commercial plugin. It has a slew of features built into version 1.x, which we will get to shortly. It is dead simple to use. It is something nearly any website owner needs, assuming they want to share their content via social networks. And, with a $39/year starting price, it is not an overly expensive product for those on the fence about buying. How the Plugin Works After installing and activating Social Image Generator, users are taken to the plugin’s settings screen. Other than a license key field and a button for clearing the image cache, most users will want to dive straight into the template editor. At the moment, the plugin includes 23 templates. From Twenty Seventeen to Twenty Twenty-One, each of the last four default WordPress themes also has a dedicated template. After selecting one, users can customize the colors for the logo, post title, and more — the amount of customization depends on the chosen template. Browsing the plugin’s templates. Aside from selecting colors, users can choose between various logo and text options. They can also upload a default image for posts without featured images. Editing a template from Social Image Generator. When it comes time to publish, the plugin adds a meta box to the post sidebar. Users can further customize their social image and text on a per-post basis. Social image preview box on the post-editing screen. Once published, the plugin creates an image that will appear when a post is shared on social media. On the whole, there is a ton that anyone can do with the built-in templates. There is also an API for developers to create their own. For a first outing, it is a robust offering. However, there is so much more that can be done to make the plugin more flexible. Version 2.0 and Beyond Thus far, Post said he has received tons of positive feedback along with feature requests. Primarily, users are asking for more customization options and the ability to create and use multiple templates. These are the focus areas for the next version. With a 1,718% increase in revenue in the past month, it seems he might have the initial financial backing to invest in them. “I’ve started building a completely overhauled drag-n-drop editor, which will allow you to create basically any custom image you want,” he said. “It will be heavily inspired by the block editor, and I want to keep the UI and UX as close to the block editor as possible.” The new template editor would allow users to create multiple layers, an idea similar to how Photoshop, Gimp, and other image-editing software works. The difference would be that it can pull in data from WordPress. “For example, an ‘Image’ layer will have options such as height/width and positioning, as well as some stylistic options like color filters and gradient overlays,” said Post. “A ‘Text’ layer can be any font, color, and size and can show predefined options (post title, date, etc.) or whatever you want. You can add an infinite number of layers and order them however you’d like.” He seems excited about opening up new possibilities with an overhauled editor. Users could potentially create social image templates for each post type. A custom layer might pull in post metadata, such as displaying product pricing or ratings from eCommerce plugins like WooCommerce. “The prebuilt templates will still exist, similar to Block Patterns in the block editor,” said the plugin developer. “They will, however, serve as a starting point rather than the final product. I’ll also try to implement theme styling as much as possible. “The possibilities here are so endless, and I’m incredibly excited for this next part.” Like this: Like Loading… [ad_2] Source link

Continue reading

Programmatically Search WordPress Posts By Date Range

[ad_1] TL;DR: The code shared in this post shows how you can modify the query that runs on the All Posts page so you can limit how you search posts to a specified date range. It’s been a little while since I last wrote about using the post_where filter for modifying the search query that runs on a given page, such as the All Posts area of WordPress. But given the fact that there are a variety of uses for retrieving posts – and custom post types – in different ways, there’s a variety of ways to use this single filter. Search Posts By Date Range In order to search posts by date range, here’s what needs to happen: Register a callback with the posts_where filter, Make sure the function accepts the string for where and the instance of WP_Query that’s running on the page Get todays date and time and the date and time for four weeks ago Prepend the where clause to constrain the results to the date return the updated query. <?php add_filter( ‘posts_where’, function ( string $where, WP_Query $query ) : string { global $wpdb; $todays_date = gmdate( ‘Y-m-d H:i:s’, strtotime( ‘now’ ) ); $four_weeks_ago = gmdate( ‘Y-m-d H:i:s’, strtotime( ‘-4 weeks’ ) ); $prepend = $wpdb->prepare( ” AND {$wpdb->posts}.post_date > %s”, $four_weeks_ago ); $prepend .= $wpdb->prepare( ” AND {$wpdb->posts}.post_date < %s”, $todays_date ); return $prepend . $where; }, 101, 2 ); The result of this function is a modified query that restricts the posts that are returned by the specified date and time. Namely, four weeks ago up to the hour, minute, and second. You can change this by updating the -4 weeks string passed to the strtotime function (but I recommend reviewing the PHP manual page linked below to understand how this function works with language like this). References [ad_2] Source link

Continue reading
1 17 18 19 20