wpismypuppet
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Fold corner of the content pageWell first off, what are you trying to “fold”? The giant background image of the girl, or the page content itself (the white box that says “beginning”)? That makes a difference in trying to help.
If it’s the large photo, then you’ll need some tweaking where instead of adding the photo to the body, you’ll have to add it to a div that wraps everything! You have a div with a class of page-wrapper which would be perfect for this, but you are already using it for some top border thing. That can easily be moved, so let me know your intentions.
You could also try a network:
Forum: Fixing WordPress
In reply to: Gallery that pulls captions from text file.This same method I posted will work in a menu as well… instead of a landing page to show all the galleries (which you should probably have when they click on “Gallery” itself anyways) you could just use a custom Walker function to populate the navigation dynamically.
If you don’t know PHP all that well, it might be time to post in the jobs piece of this forum and get some help. What you want it a little advanced and you won’t get the whole code for free in this forum.
Sorry for the bad news…
Forum: Fixing WordPress
In reply to: Gallery that pulls captions from text file.Well, I guess in your case you will want to use the full PHP approach. Forget all that is WordPress for this gallery… no plugin (that I know of) will allow you to do both. How good are you at PHP?
I would still use glob() to get all the images inside the folders, but I changed my mind and would instead use fopen() and fgets(). fopen() simply opens the text file and fgets() will get one line at a time and place that into a string. Since each of your images|caption are on separate lines, this makes the most sense.
Make two template files… one to hold ALL galleries showing a single thumbnail for each gallery and making it clickable to take you to that particular gallery. Then make another template file that will show all the images inside that particular gallery. BOTH templates will work almost exactly the same… the difference being in the text files read and the path to start from.
Set up your folder structures
Start with a galleries folder inside your images folder (images/galleries). This will be the “root” where all the galleries live. In fact, if you do the code right, all you’ll have to do is create a new folder inside the galleries folder, populate it with images and a text file, and the code will dynamically add that gallery to your site automatically.Inside this folder should now be all your galleries in separate folders. i.e. “images/galleries/gallery-1”, “images/galleries/gallery-2” and so forth. Name them whatever you like though, it doesn’t matter. It doesn’t even have to follow numeric importance or anything, unless you want to “order” your gallery a certain way.
Inside each of these gallery folders should be a folder called “thumbnails”… i.e. “images/galleries/gallery-1/thumbnails”. This will, of course, hold all the thumbnails for each larger version image. You can skip this step if you plan on using timthumb to generate the thumbnails on the fly.
Inside each of these thumbnails folder, create a “featured.jpg” thumbnail that will mimic your WordPress featured image. This way you’ll always know to call featured.jpg whenever you want to show the featured image for any gallery. We’ll get to this in the next section.
Code the Landing Page (the one that show all the galleries you have)
At this point, code the first template. Use glob() to gather all of the folders inside your root “images/galleries”. Make sure you use if statements to remove unnecessary folders such as ‘.’ and ‘..’. Then loop through each result calling for the featured.jpg image inside the folder’s “thumbnails” folder and add a hyperlink around the image to take the user to your second template, passing the folder name in the URL. This is how the second template will know which folder to show.If you want to get fancy, you can create a text document in the root that has description information for each gallery… the way to read this file is exactly the same way as we’ll use for the second template.
Code the Second Template (shows the individual gallery’s thumbs and full sized images)
This template does a lot of the same things as before. Use glob() to gather all the images inside the folder name passed in the URL. You already know it’s going to be “images/gallery” so just append “/folder_name_from_URL” to the path for glob(). Again, use if statements to remove unnecessary folders AND files. We don’t want to grab that text file, just the images. Next use something like this:$handle = fopen("inputfile.txt", "r"); if ($handle) { while (($line = fgets($handle)) !== false) { // process the line read. } } else { // error opening the file. }Again, you should know the path is “images/galleries/folder_name_from_URL” and you also know the name of the text file… so the fopen should make sense. Every time you iterate through one line of the text file, explode() that line using a pipe (|) because you are already using the pipe to begin with, and then loop through the glob() results to locate the image in question. Use that information to display the thumbnail and link it to it’s larger counterpart.
You can also use things like prettyPhoto or imageZoom to make the whole thing a lot prettier.
I know this looks and sounds like a lot, but believe me it’s really only 20-30 lines of code max. Most of it is repetitive code… Let me know if you need more direction. Do a search on the PHP site for the functions I’ve referenced and you’ll get a lot of examples of how they are used. Some might even be the exact answer you are looking for!
Forum: Fixing WordPress
In reply to: Simple javascript in page not workingDon’t be so hard on WordPress… think about what WordPress was developed to be: originally just a blog platform, and now a content management system, for the non-programmer. It’s suppose to be an easy way for anyone to update their website content without the need to know JavaScript, PHP, HTML or CSS. So technically the content editor is doing exactly what it should be doing.
We as programmers/developers know a little more about the world wide web and it’s many languages, so WordPress developers have given us many “hooks” to tap into the power of WordPress. Hooks such as the wp_enqueue_script(). This way we can still do absolutely anything we can think of. But for the average Joe… the out-of-the box solution is simply perfect!
Forum: Fixing WordPress
In reply to: Dynamic "New Content" Label on Menu Items (posts)?Great!
What I would do, if I were your programmer, would be to create a “links” table (or other such appropriately named table) in my WordPress installation. Then, in my header.php file I would run a SQL query as the very first thing to update my table with the user’s ID (of the logged in user), and the ID of the page/post/whatever they are currently looking at.
I would probably keep the ID’s of the pages and the user ID as one row instead of separate rows, to keep the database small, but that’s just me an I’m not a database engineer. This way the table will only be the same number of rows as there are registered users.
You could probably get away with two columns, one for the user’s ID and another for a comma separated list of page/post/whatever ids. Example:
userID postIDs 21 1,2,32,45If, however, you wanted to record the date a page was first/last access, you’ll need to put each entry in it’s own row. Example:
userID postID dateFirstViewed dateLastViewed 21 1 12345678912 53627848956 21 2 12345678332 53627848956 21 32 12345678912 53627848956Note that the same userID is used for all three entries to indicate this user visited these three pages/posts/whatever. Also note that the dates are timestamps, not actual dates. Better to store timestamps in a database then something like 8/2/13 4:32pm.
So first, my function would update my table, then my function would update a new session variable to contain all of the information we just put into the database. This way I can reference the session variable to notify the user of where they have already been on my site without taxing the server by constantly querying the database. Looping through one variable 10 times is way easier than querying a database 10 times.
Using for loops, if/else statements, or whatever other means I need, I could add class names to links, make “new” or “old” content tags, or whatever other creative way to show distinctions in the content.
I’m sure there are plenty of other ways to do this, and some more efficient than mine, but this is off the top of my head without too much thought and time put in. This should at least get your programmer started in the right direction.
Forum: Fixing WordPress
In reply to: how to show differnt menu when administrator logged inUse something like this:
<?php if( is_logged_in() && is_admin() ) { // show extra menu tabs } ?>Forum: Fixing WordPress
In reply to: WordPress Top Search Not Working!You have a JavaScript error on the page… When you get a JavaScript error, the script will completely stop at that error. Anything that executes before the error will work and run just fine, but since the code used to create the search box slide comes after the error, it never executes causing the whole search thing to fail (poor fall back programming on whomever wrote that!).
I don’t know what the error is, other than it’s part of main.js which is a compressed JavaScript file, where “a” is undefined. “a” could be anything since the file is compressed. My suggestion would be to back up your custom pages and re install the theme.
P.S. “you have included the Google Maps API multiple times on every page, which can cause unexpected errors.” According to Firebug…
Forum: Fixing WordPress
In reply to: How to have two excerpts ?Your answer lies in custom fields. There are many plugins that make using custom fields easier than doing it yourself, but this is what you’ll need. This way you can have the normal excerpt, and the unique one can be a custom field instead.
Forum: Fixing WordPress
In reply to: Gallery that pulls captions from text file.So you are looking to keep the folder structure, with the images inside those folders, with the text file that contains the captions for each image? You don’t want to upload those images to WordPress and place the caption on the image there?
There are a lot of solutions (relatively easy ones) that use PHP’s glob function and file_get_contents() function to do what you are asking for.
Right now, for a quick fix, it may seem like a good option. But in the long run, if you are going to be adding more images and captions down the road, WordPress is a much better solution. Trust me as I’ve done both options extensively. Almost every PHP folder/text file solution I’ve created for a client (created for the same reason you have mentioned… monotonous work) has been converted over to WordPress due to the ease of use (and lack of photo manipulation/programming/FTP experience).
The reason no WP plugin exists that pull from a text file is because it’s not necessary… and in fact it’s repetitive and pointless based on the way WordPress works. But since you already have a lot of work started, I can see how you are looking to avoid duplicating work just to get the site done.
Let me know which path you want to travel down and I can offer some assistance.
Forum: Fixing WordPress
In reply to: Sentence case CSSNo CSS can transform the first letter of a sentence only… You’ll need to use JavaScript to do so. The only thing CSS can do is all upper, all lower, and title case.
If you want to use the JavaScript idea, let me know and I can offer assistance. Although I don’t know why you wouldn’t want to use title case for your titles… 🙂
Forum: Fixing WordPress
In reply to: Dynamic "New Content" Label on Menu Items (posts)?Interesting situation… there are quite a few things to think about when attempting to “track” a user’s experience. For instance, do you need it to work all the time, no matter where the user visits the site from? In other words, if I visit the site from home, then check it from work, should my work machine indicate things I’ve already read?
Basically I can think of two ways to do this… the first is simply using cookies and the already present “visited” links which is already tracked in the browser. Combining these two options, you could easily accomplish your task. It is volatile though, meaning that after a few weeks (depending on the client’s browser settings) all those visited links will be cleared or reset, causing all of your content to be “new” again.
A second solution would require user’s to be logged in. Having a user log into the site sets up a very easy way to track, and a non-volatile way to show them new content without the worry of them seeing old stuff marked as “new”. Plus you could easily email registered users when new content is available.
Let me know which path you are planning to stroll down and I can offer a little more insight.
Anytime… glad I could help!
Well, I don’t know of any documentation that would explain pagination… But I can tell you how it works (in an over simplified way, of course. SQL is very powerful and too difficult to explain in a forum).
All WordPress pages/posts/attachments/whatever are loaded through a database. The URL in the address bar contains information that is run through SQL statements to get information from the database. Even if you have “pretty” URLs, the underlying “real” URL contains query string data.
When you request a page, a SQL statement pulls ids and other query information from the URL and pushes it through a SQL query. This is how it knows what post type and ID to show you. Once the SQL is run, it goes through a hierarchy of page “templates” (or physical pages such as index.php or page.php) to display the database information.
When you paginate, you are passing a “page number” variable in the URL. The SQL statement uses that variable to know which IDs to get based on a “start” and “end” value. It “fakes” pagination by only showing a certain number of returned SQL table rows. Again, the variable in the URL tells it what to do.
When you see page /2/3/4/5 and so on, you are looking at the same “physical” page (index.php or page.php, etc.) and it’s displaying a different SQL query based on the variable it finds in the URL.
Hope that sheds some light.
Forum: Fixing WordPress
In reply to: How to Make Embedded YouTube Videos ResponsiveDo a simple Google search… you’ll get results like this:
http://avexdesigns.com/responsive-youtube-embed/
Your problem is not with WordPress or the embed… it’s all CSS driven.
And if you need to add a <div> around your embedded video, use something like this:
add_filter( 'embed_oembed_html', 'custom_oembed_filter', 10, 4 ) ; function custom_oembed_filter($html, $url, $attr, $post_ID) { $return = '<div class="video-container">'.$html.'</div>'; return $return; }For what it’s worth, as a developer I’m glad they strip code out of the editor. Most clients don’t know what to do with it, and they end up breaking layouts by trying to get fancy. A good developer knows how to manipulate default templates and even create their own if needed. Don’t hate on WordPress… do some research and learn.