Can't get wordpress to stop making an additional HTML section? - php

hope everyone is having a wonderful afternoon!
I have been developing a website, and have for the most part left with removing unused assets, and cleaning up the code.
I have managed to remove most of the non-essential material, however I can't get past understanding how and why does my HTML produces another separating , and I cannot find a way of removing it.
The website is managed by Wordpress and is constructed with shortcodes:
Question: How do I remove the up top of the one and only that is needed?
Thank you so much for clarification in advance!

In case you are working with wordpress, and have noticed something similar to my situation, then a problem resides in the WP Dashboard, which in turn is also critical to check if you have all semicolons in place. If not, the loop will continue to repeat itself and hence creating empty rows after rows until it's empty.
In my instance, it was looping trough and checking for contents of rows and hence made an another instance of a row.
Hope this helps to anyone who may encounter similar issues when working with wordpress shortcodes!

Related

Dynamic content in PHP WordPress page

I have a ecommerce store website running with WordPress. I'd like to include a section with a -random custormer's product review, so that every time someone access the page, there will be a different comment there.
I'm not used to PHP, but I managed to create a shortcode which takes a random comment and returns the proper HTML. It is working fine (in eddition mode, every time I insert the shortcode a different comment appears).
My issue is that when I leave the page and return, the previous one is still there. I believe that it is being caused by cache, but I wouldn't like to disable the cache for the whole page.
How you I force the shortcode run again (I don't know if it is the right way to explain) and make sure that at every access, a different comment appears?
One solution I thought is to have JS code which would do preaty much the same thing my PHP code does, using Woocommerce API to get the data. But I'm wondering if there is a simpler solution to do that, like forcing the specific section not being cached or re-run the shortcode.
Thanks!
JS can't do what PHP does here: at most it can create an AJAX-call to the backend that then runs a query for a random comment and returns it. You need to render it thereafter. It's fairly standard, but overkill for your case.
Instead, you're going to want to check whether your caching mechanism supports ESI or something else that excluded parts of your code from being cached.

wordpress file execution order

I have a wordpress site which I manage(I am not a developer)
I ran a pagespeed test via https://developers.google.com/speed/pagespeed/
I got some issues like caching problems and so on so I used several plugins to take care of them.
however Im now stuck with Optimize CSS Delivery problems.
so I thought to try and fix it by myself and move the problematic URLs to the end of the page, however I cant figure out where these URLS are coming from. or which page is requesting for them.
appreciate any help with this
What I do in similiar situations: put some text inside the HTML elements of any php-file. E.g. put in page.php the "page-top" somewhere in the beginning of the file, put "page-end" at the end. In footer.php etc do the same. So you come very fast to the corner where the URLs might come from.

Create a customizable list of book nodes

I'm working with Drupal and the book module right now, and it works perfectly for what I need.
The thing is, I need a way to print out a navigation similar to the one generated by the book block, but so that I can change what it outputs.
How do I print out a custom version of what the book block/book navigation prints out? For example, so that I can change the HTML output.
I hope this is clear enough, and please let me know if I need to add anything to make the question more clear.
Thanks in advance!
I don't exactly know how you want to modify that block, but you have several options.
If you don't need too big changes, probably it can be done with some CSS hacking
There are a few modules that do similar things, for instance Book Block or Advanced Book Block
Finally, you can always check out the book_block function, which prints the block and create a custom block with the necessary modifications

Wordpress format issues - archives and spacing

So hopefully you guys can help me solve this riddle as I am lost at how to fix this issue.
A couple months ago we updated our website and our blog, in doing so I copied over the database and all the old posts. However, for some reason posts older than 2+ years are having format issues. Instead of spacing correctly, the entire blog is bunched up. You can see an example below.
Example
Now looking at the post I can see that there is no html to signify paragraph breaks and it generally looks like a text document with only a couple tags in there. I have been going through by hand on these posts adding tags and the correct tags where necessary, obviously this is EXTREMELY time consuming and as there are years of old blogs that need to eventually be updated, I was looking for a way to simplify this issue.
My theory, is that there was some wordpress plugin in place on the old site (I did not manage this) that fixed the format issues and displayed the posts correctly, however somewhere down the road it got fouled up.
Does anyone have a suggestion on how to fix or maybe even speed up this process?
Thank you!
Well after a few more hours of tinkering and research I think I found a way to make the process faster. I still have to edit some of the posts manually, but at least now it appears I don't have to add those <br> tags back in.
Here is the resource I found. PS Disable Auto Formatting
And here is what I did to speed up the process. I should note it is a good idea to backup your Wordpress Database for doing this!
Download the plugin and install it.
Activate the plugin
Go the plugin option screen and UNCHECK the box titled "content formatting" basically enabling it
Go down to the batch formatting and select the date from which the older posts started and check "Allow batch formatting"
Click Batch Formatting and the plugin will format your older posts putting in <br> tags where appropriate and spacing where appropriate.
Browse to one of the edited posts and you will see it looks all jumbled and strange, thats fine dont worry!
Now head to your plugins page and DEACTIVATE the plugin. Go back to one of your posts after the plugin has been deactivated and you will see that the post is now formatted correctly!
Make any additional edits to the post(s) and hit update, and your older posts should now be fixed again.
This solution isn't perfect but it will save me time in the long run.
Thanks and good luck.

Magento Using all attributes within layered nav

I currently have a load of attributes already setup as text boxes - is there anyway I can get them appearing within the layered nav?
Any help would be much appreciated.
Regards
Shane
Given what you are looking for, Magento does not support what you want by default. However, the Magento filter code is fairly well structured, so this is something that you could add at will. The relevant backend code that will need to be modified is in the Catalog/Model/Layer subdirectory. Specifically, you will need to edit Mage_Catalog_Model_Layer to accommodate your new code. Also, you'll need to add a class that implements Mage_Catalog_Model_Layer_Filter_Abstract, to handle the actual filtering code. Finally, you will need to make the options appear on the frontend, which (in my cursory examination) will require two major changes. Firstly, you'll need to change the backend to allow the admin to mark text fields as being filterable, after which you'll need to modify the frontend template to display the checkbox fields.
This is a really significant amount of work. If at all possible, I'd recommend avoiding this route as it will also probably cause you significant problems down the road.
Hope that helps!
Thanks,
Joe
Right for anybody else looking at this, I looked into going down the custom code route, but quickly back tracked...
I decieded to bit the bullet, delete my attributes and recreate them and import the products again.

Categories