Skip to main content

Questions tagged [wordpress]

WordPress is a free and open source blogging tool and a content-management system (CMS) based on PHP and MySQL.

Filter by
Sorted by
Tagged with
2 votes
1 answer
70 views

Listing links for categories

I've developed some PHP that grabs all of a business listing's categories and then displays just the children categories. This is built on Wordpress. I'm still in the learning process and would ...
Delto's user avatar
  • 123
5 votes
1 answer
154 views

Related links for WordPress posts

I have written the following class which is part of a pagination system in Wordpress. The class works as expected and also works as expected when used in the system. Just as background, the class ...
Pieter Goosen's user avatar
2 votes
0 answers
23 views

Limiting WP user's access to the amount of credits they have

I like this solution but maybe there is another way. My goal with this is to limit user editing to the amount of credits they have. What do you think? Here is what it does: Credits are stored as ...
Kobus Beets's user avatar
3 votes
2 answers
9k views

PHP function (in WordPress) echoing HTML

I'm really new to PHP, and a little less so in WordPress. I've created a working function that spits out some static HTML into a page template in WordPress. I'd like to know if there is a best ...
alexwc_'s user avatar
  • 249
1 vote
1 answer
44 views

Multiple Wordpress metaboxes in fewer different functions

Is it possible to call multiple metaboxes in Wordpress with less duplicate functions? For instance, these are my current metaboxes (3 of them, one is a checkbox and two others are text input fields): ...
Bram Vanroy's user avatar
1 vote
1 answer
231 views

Interface injection and common functionality between classes

I'm trying to get my head around the OOP principles and coding my own classes. As a means to learn, I have decided to convert a couple of functions I have written in Wordpress to OOP classes. These ...
Pieter Goosen's user avatar
3 votes
1 answer
352 views

Reading and Converting XML File to Array

I'm using WordPress ( PHP Based Platform ) and I'm trying to read an external XML File, convert it into a usable array, then compare two arrays - one from the xml file and another from an options ...
Howdy_McGee's user avatar
6 votes
2 answers
1k views

Checking for existence of URL parameters

I'm busy rewriting some from my spaghetti code into OOP classes. I'm still learning OOP and very new to the concept. From help from this answer from @EliasVanOotegemto on a previous question I've ...
Pieter Goosen's user avatar
3 votes
2 answers
534 views

Sort by a custom date field

I've got this code to work, but being really new to PHP, I don't know if this is proper. I've sorted a CPT loop by a custom date. I'm displaying items from most recent (or future date) to oldest if ...
alexwc_'s user avatar
  • 249
3 votes
2 answers
422 views

Correctly coding an OOP object

I have a couple of functions in WordPress that I'm rewriting to OOP. All these functions are interlinked in some way and also reuse code from other functions. This is an example of the first class I'...
Pieter Goosen's user avatar
1 vote
1 answer
2k views

Button to follow / unfollow a user

As a beginner in coding, I have just written this code. The code should Add a form with a button to each user profile, it named Follow or Unfollow. It updates the user meta named "following" for the ...
Sufyan Hassan's user avatar
2 votes
2 answers
78 views

WordPress: multiple loops

I have two loops on my page - each with their own category. It works, but I don't know if this is the best practice as I'm pretty new to this stuff. ...
alexwc_'s user avatar
  • 249
2 votes
1 answer
342 views

Navigating calendar by week

I started actually learning a little programming last year, as opposed to just hacking away at libraries and found fragments. For a WordPress plugin I needed to navigate through weeks, which I ...
MikeiLL's user avatar
  • 630
2 votes
1 answer
4k views

Removing stray brackets from in between shortcodes

I was wondering if someone could point me in the right direction for cleaning up this code. WordPress uses shortcodes in the form [shortcode] to add extended functionality to posts and pages. What ...
gregpress's user avatar
5 votes
2 answers
84 views

First WordPress template

I wrote my first template, but didn't include any styling. What do you think? What's good what's bad? ...
Townsheriff's user avatar
1 vote
1 answer
421 views

Automatic password security test for WordPress

I was bored the other day and wrote the following little script to attempt to find insecure passwords for WordPress blog owners so they could be notified of how easy it would be to crack their WP ...
morissette's user avatar
6 votes
3 answers
6k views

Listing WordPress posts with thumbnail images

I am using the following code poor form. I am interested in how I can optimise this and use the correct methods. I understand the DRY concept and will look to employ that throughout my code. However, ...
Taylorsuk's user avatar
  • 261
6 votes
3 answers
886 views

Check efficiency of PHP code that will query over 8500 orders

I am querying all orders from a WordPress database that uses the WooCommerce Bookings plugin. I want to display upcoming bookings, and there is a potential to have every hour within 2015 to be booked; ...
katart's user avatar
  • 61
2 votes
1 answer
77 views

DB security and efficiency in WordPress plugins

I recently wrote my first WordPress plugin, which was also my first PHP project. After I was done, I didn't care for the code at all, so I have spent the past couple of days refactoring it. I'm trying ...
RaneWrites's user avatar
2 votes
0 answers
380 views

Plugin that grabs the coordinates of all the cities in our database

I have a plugin that grabs the coordinates of all the cities in our database working in WordPress here. ...
user3436399's user avatar
2 votes
1 answer
238 views

Social sharing counter plugin [closed]

I am creating a social sharing counter plugin for my WordPress blog. I want to fetch the counts of number of likes, shares, Facebook comments (I am using Facebook comment box), twitter tweet counts ...
Ahmed's user avatar
  • 131
12 votes
2 answers
376 views

First attempt - Wordpress PHP Settings API wrapper

I've been working on what is essentially my first proper attempt at making a useful PHP wrapper class for the Wordpress Settings API. It works great so far and I plan to add more methods as I go so ...
glitchmunki's user avatar
6 votes
2 answers
2k views

Trim string of words based on character count

I needed a simple way to trim a string of words based on a max character count. I also needed to cut in-between words. Using WordPress, here is what I came up with, but I feel like it could be more ...
Mike Grace's user avatar
2 votes
0 answers
295 views

Automatic submenu

The goal here is to create a Top Level Menu that automatically pulls child pages without the need to manually add them to said menu. I didn't know any other way to accomplish this without a walker, of ...
Howdy_McGee's user avatar
2 votes
2 answers
166 views

How do I refactor this responsive background images code?

In my latest project I am using fullscreen background images for each page. I decided to write some code to fetch the different thumbnail sizes and then use it as a background for the appropriate ...
thedigitalmonk's user avatar
2 votes
1 answer
121 views

Wordpress filter post by metavalue

I am making a filter to get posts by status that are saved by post metavalue in a Wordpress plugin. It is a question and answer system, where the question and answer are post objects. ...
Munch Lax's user avatar
  • 121
6 votes
3 answers
439 views

Evaluate a Contact Form CSS

I am a total novice to web development, but I am trying to be a WordPress developer and have been actively at it for some weeks now. All self-taught with the world's best tool as my aid: the internet. ...
user2991456's user avatar
6 votes
2 answers
193 views

WordPress Post Type template

I have created this class for my WP theme. It allows you to create templates for a meta box which relates directly to a custom frontend template to have better control of the content displayed on the ...
Nathan Fitzgerald - Fitzgenius's user avatar
3 votes
1 answer
452 views

WordPress Functions.php file

I am making a WordPress "framework" for myself. Looking at the functions.php file file, is there redundant or bad code that could be changed or some code that could be good to add? The functions.php ...
Pullapooh's user avatar
3 votes
1 answer
556 views

Plugin for WordPress and Foundation Reveal

I figure that someone here probably knows a much better way to do this. I'm still figuring out AJAX and jQuery, so I consider that I still need to master quite a bit of knowledge. My function ...
tnog's user avatar
  • 131
3 votes
1 answer
235 views

Exporting data in a WordPress widget

I have some custom tables in a Wordpress database that I need to export to CSV. I created a dashboard widget to help with this based on some assistance given to me on on one of my SO questions. It ...
tjans's user avatar
  • 171
2 votes
3 answers
167 views

Displaying fields in a sidebar of a custom page template

I'm beginning with PHP programming and would appreciate a critique on my code and how I could make it more efficient, rather than repeating the if statements. What ...
user88659's user avatar
2 votes
1 answer
127 views

jQuery eye candy for a WordPress site

This is a follow-up to this question my code has evolved since so I'm reposting my question. What is the best way to tidy this up? How can this be refined? I am finding it's thrashing the layout ...
vimes1984's user avatar
  • 181
3 votes
3 answers
931 views

jQuery animation and rotation effects for a WordPress site

What is the best way to tidy up JavaScript code I have written? It seems very long winded, any suggestions to shorten it? Note: I'm running it on Wordpress which runs jQuery in nonconflict mode, ...
vimes1984's user avatar
  • 181
2 votes
1 answer
375 views

Simple theme options held in array

I have created WordPress theme options using an array, and it is working. There are 5 type of input: text, textarea, ...
Script's user avatar
  • 123
6 votes
3 answers
266 views

First Wordpress plugin for saving a post

This is my first Wordpress plugin. I would love some input from the WP/PHP/JavaScript gurus out there. It's a simple plugin that saves a post using ctrl-Q and opens a preview in a new or current ...
FajitaNachos's user avatar
2 votes
1 answer
127 views

Wordpress $wpdb->row Query Check

Looking at $wpdb class, I found get_row, and I am unsure if the function automatically prepares the query. I believe it does not ...
Anraiki's user avatar
  • 123
3 votes
1 answer
252 views

Function from WordPress VoteItUp function [closed]

This code comes from a Wordpress plugin's forum called Vote it Up. It sort posts by vote. A lotof people say that there is more code than is needed. So I was wondering if someone have any idea about ...
wyc's user avatar
  • 555
5 votes
2 answers
267 views

Displaying all single posts

I think there are some confusing and weird indentation problems in this WordPress file (single.php). Any suggestions on improving indentation and readability? ...
wyc's user avatar
  • 555
6 votes
2 answers
565 views

modify custom loops to improve readability and efficiency for Wordpress?

The following code retrieve custom post types with their custom taxonomy. I'm just a beginner in PHP and I would like to know tips in order to improve readability and perhaps efficiency. home.php: <...
wyc's user avatar
  • 555

1 2
3