Wordpress.... I hate you.



  • So, I get all the way to the point where I have to upload this little dynamic formlette that I built, and lo and behold, Wordpress doesn't give pages a way to inject custom stuff into the site template for only that page.

    Ok, well let's just use a different theme for this one page.

    Fuck you... no.

    Ok, let's just clone the theme we have, create a new one, throw some code into the header and make it activate only there's a post to the page.

    You can't clone a theme.

    Add a new one?

    pops up a page letting me download a theme.

    Ok, ok, I'll just edit the one in production.

    @#$@#%!!

    Ok, so how can I do what I want?

    Install these 30 plugins.

    Hell no, I'm not drastically changing the functioning of their site for a simple....

    Fuck it, I'm being evil.

    finds iframe plugin
    uploads files to server
    points iframe at the form's php

    Ok. Here you go....

    I hate myself...



  • This post is deleted!


  • @xaade Actually you can use different theme for a single page and it's not that hard to do - you just make one file in your current theme (call it *-template.php) for all that custom stuff and select it as the page theme. No plugins required. It's a bit ass, but it does the trick. Fun thing is, when you update your theme, your custom template file will be deleted.



  • @NeighborhoodButcher

    1. That's broken as hell.
    2. Does it let me inject into the <head>, because that's where I need it. The theme encapsulates the <head>, so I'd have to edit the theme to solve that.

    I'm guessing that if you want something more than scriplets in your pages, you need to really just build a PHP MVC-like into the theme, and use javascript to load endpoints. That way your app is always present, and you always have the api that you need.

    Problem is that my task was a one-off form, that was very dynamic in nature.

    I had to have a form add items to a list, and then submit that array of data to be emailed off. Knockout did a good job of handling it, but when it came time to move this into WordPress, oh hell no....



  • @xaade

    1. yes
    2. no


  • And the founder has the nerve to say this is good for app development.

    Yes, if you are leveraging the theme to store your PHP-based MVC in.

    If you are trying to mix apps with multi-page site.... screw you.

    And that concept is not friendly to developers. It's friendly to marketers. WordPress is a marketers dream. Everyone I know that specializes it is a marketer, not a developer. Everyone I know that is a developer, specializes in a technology made for app or web development. Usually ASP.NET or ruby.


    Any real developer will place their theme/template into the page, not place the page into the theme/template, because that's how they utilize the header/footer/etc to make different forms and apps on the same site.

    Want to embed php into the middle of a wordpress page.... screw you. Now, go get this "plugin" that breaks that restriction because, plugins.



  • @xaade said in Wordpress.... I hate you.:

    Does it let me inject into the <head>, because that's where I need it.

    That’s why, for one of the two WordPress themes I built myself, I put the </head> and everything after into each page template rather than into the header file.


  • Winner of the 2016 Presidential Election

    @Gurth Holy shit, I'm so glad I never used Wordpress. Just reading about those hacks gave me a migraine.


  • area_pol

    @xaade You can override the template used by the page:
    https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/

    Ok, let's just clone the theme we have, create a new one, throw some code into the header and make it activate only there's a post to >the page.
    You can't clone a theme.

    Copy the theme's directory in wp-content/themes, change the name specified in style.css



  • @Adynathos How does that let you override on a single page? Do you specify the css on each page.

    I'm not doubting there's a solution to this, it just must be very obscure and I don't have the time to investigate.



  • @Gurth

    They were using DIVI. Which basically hijacks everything. There's no defined section that DIVI won't touch, like in old WinForms. It replaces everything, everytime. And if you switch a page to the default editor after you use DIVI, it removes everything it did.

    It's basically the evil of Frontpage, but without even letting you edit manually... ever...

    Again, this is all from what I can tell, I ran out of patience after 2 hours of looking at it.



  • @xaade said in Wordpress.... I hate you.:

    I'm not doubting there's a solution to this

    Yes there is. And @NeighborhoodButcher already told you it. You just need to add a hook before you call get_header.



  • @ben_lubar That's magnitudes more clear than what he said.

    How do you put php into a page?

    It strips it out when I try..



  • @xaade template

    What you're doing is equivalent to writing C++ in Microsoft Word.



  • @ben_lubar I liked Ben L before he was a condescending smartass.



  • @ben_lubar

    Ok, on the single page, it opens up, there's NOTHING there. Blank page.

    What do I put in it.


    Ok, so now I see you can have page specific templates.


    You know what, this whole system is bunk.

    In a real web development environment, you'd write a page, and manually place your template files in the page, with access to everything. No javascript hooks, you want to add something to the header, it's right there.

    And they could have all this Frontpage junk and still manage to let you work this way, by giving you a box above the page editor that gave you access to a portion of the header that isn't overwritten.

    And they could even let you WYSIWYG select the stuff from a list of templates what goes in there.

    Javascript hooks just means runtime processing just to add something because they've locked it down.

    Hell, even MYSPACE was better than this.



  • @xaade I'm sorry, what JavaScript is running on your PHP server?



  • @xaade That's sort of the point of PHP. It runs on the server; the PHP code doesn't get served to the client at all, but instead gets replaced with the HTML the script generates. Hence the original expansion of the name, "Programmable HTML Preprocessor" (later changed to "PHP Hypertext Preprocessor").

    True, PHP is a truly crappy implementation of server-side scripting, but to be fair so are classic ASP, ASP.net, Node.JS - in fact, every server-side approach I've seen pretty much sucks donkey balls, mainly due to the limitations of HTML and HTTP themselves. The point is, though, that you need to understand what is running server-side and what is running client-side, because most current web pages require both.



  • @blakeyrat said in Wordpress.... I hate you.:

    @ben_lubar I liked Ben L before he was a condescending smartass.

    HE LEARNED IT FROM YOU

    and me

    and <?php echo(implode(GetAllUserNamesInForus(), ",")); ?>



  • @Lorne-Kates said in Wordpress.... I hate you.:

    and <?php echo(implode(GetAllUserNamesInForus(), ",")); ?>

    What the shit did the parser do? <?php .... ?>



  • @ScholRLEA said in Wordpress.... I hate you.:

    That's sort of the point of PHP. It runs on the server;

    No,

    I mean, the wordpress code strips out PHP that you put into the page before it serves it to the PHP preprocessor.

    Look it up, you have to actually use a plugin to put PHP in the middle of your page.

    PHP in the templates work, but not in the page.



  • @ScholRLEA said in Wordpress.... I hate you.:

    Hence the original expansion of the name, "Programmable HTML Preprocessor" (later changed to "PHP Hypertext Preprocessor").

    The original name was "Personal Home Page" :pendant:



  • @xaade Ah, gotcha. Why am I not surprised that Turdpress does this? I mean, I can sort of see the argument for it, as mixing generated code with hand-written code can be dicey, but you would expect that they would have some way to allow you to add your own code to the page without (these are the real key parts here) hiding that mechanism in the middle of 100 pages crappy documentation, or make using it punitively difficult. Given what I have seen of the WordPus docs, I suspect that even if there is such a facility, you'll never find it without a native guide and a machete.


  • area_pol

    @xaade said in Wordpress.... I hate you.:

    How does that let you override on a single page? Do you specify the css on each page.

    As we see in Page Templates within the Template Hierarchy section, you can override the template used for specific pages.

    So, let's say we have a page with slug snowflake, like this:
    0_1461447003553_wp_page_editor.png

    Now, inside our theme, we create a file page-snowflake.php, matching the page's slug.
    wp-content/themes/my_theme/page-snowflake.php:

    <h2>This page is rendered in a special way</h2>
    <?php
    	the_post();
    	the_content();
    ?>
    

    When we open the snowflake page at http://my_site/snowflake, we can see the file we just created is used to render the page:
    0_1461447182165_wp_page_rendered.png

    In page-snowflake.php, you fully control all the HTML which is sent to the client, so CSS as well.

    Funny how this week I had my first (and probably last) contact with wordpress, as it was the topic of a course assignment. But now I am glad I could use the knowledge for something.


  • Discourse touched me in a no-no place

    @ben_lubar said in Wordpress.... I hate you.:

    What you're doing is equivalent to writing C++ in Microsoft Word.

    Templates are a thing in Word anyway. Even without their ability to include code, they're still useful as they can set up a theme and boiler plate pages that you can use without having to spend time on mucking around. Deal with government much (especially on anything that isn't just handled by standard forms) and you'll end up loving those templates…

    I wish I didn't know this from experience. :cry:



  • @Adynathos said in Wordpress.... I hate you.:

    In page-snowflake.php, you fully control all the HTML which is sent to the client,

    :pendant:

    Except that you don't, do you? You control everything that's sent within the <div id="content"> element (or possibly some subelement, I forget, been a while since I delved into the hell that is turdpress)



  • @xaade said in Wordpress.... I hate you.:

    Look it up, you have to actually use a plugin to put PHP in the middle of your page.

    Would you rather that basically just anyone is able to put code that executes on the server in any post?


  • area_pol

    @tufty said in Wordpress.... I hate you.:

    Except that you don't, do you? You control everything that's sent within the

    element (or possibly some subelement, I forget, been a while since I delved into the hell that is turdpress)

    No, you control everything. In this example:
    0_1461492847330_wp_page_src.png

    If you want to include wordpress's generated header part, call wp_head() (or get_header to render your header.php or one of its variations)



  • @Adynathos Ah, right, my bad. "senior moment".



  • @blakeyrat said in Wordpress.... I hate you.:

    @ben_lubar I liked Ben L before he was a condescending smartass.

    Competition sucks, doesn't it? :P



  • @xaade said in Wordpress.... I hate you.:

    I hate myself...

    This is my entire experience with SugarCRM.

    Broken PHP shit.

    :fire:



  • @Gurth That's why you strip posts...

    This doesn't require you to strip pages, pages that the owner of the website adds.


    But I don't want to start up an argument over it. Not worth it. Wordpress is the new Frontpage. You can template without creating such a restricted system that requires you to write javascript code to hook into the header of an individual page. (which, btw, let's anyone inject into your header client-side).

    Is it great for people that want to spin up a themed site with standardized access that prevents their interns from nuking their site from a single page? Yes, absolutely.

    Can you create such a system that doesn't interfere with advanced editing? Yes, you can. I worked for an internal app development team that did just that. It's not a lot of effort to spin up something that gives simplicity to the non-developers, and greater access for the developers.

    It's popular because it's easy, not because it's great.



  • @xaade I'm sorry, at what point is the HTML being processed by a site supposed to go through the compiler that built the software that site is running on?


  • Winner of the 2016 Presidential Election

    @xaade said in Wordpress.... I hate you.:

    It's popular because it's easy, not because it's great.

    That's a huge understatement. Wordpress is not only ""not great". It manages to make the PHP ecosystem look even worse than it already does by itself, which certainly isn't easy.



  • @ben_lubar ???

    TDEMS...

    The pages exist in a database.

    The "compiler" is an interpreter. You could have PHP that is loaded by PHP that is loaded by PHP that runs PHP on the PHP.

    Besides, you can also do this with C#.

    C# has a compile function. You can load up a file with a C# program, that compiles the file, which is a program that loads another file and compiles it.

    There is no such limitation on either language.



  • @xaade ok, now explain to me why your C# document editor should have a C# interpreter in it.



  • @ben_lubar For the same reason that my HTML document editor has an HTML interpreter in it.

    oh look <b>oh look</b>



  • @xaade I'm going to quit this argument because you clearly have a different definition of every word that has been said so far.



  • @ben_lubar No, you do....

    I don't know of any other definition for a run-time interpreter.


  • sockdevs

    @xaade HTML isn't runnable. It has no conditionals, no looping, it is not a programming language. The client and server are not interchangeable.

    And before you start quoting your PHP and C# are interchangeable, fuck off they are not because C# is not runtime interpreted on a server.



  • @Arantor said in Wordpress.... I hate you.:

    HTML isn't runnable. It has no conditionals, no looping, it is not a programming language. The client and server are not interchangeable.

    You're editing a file. A file that's going into the database. That will be loaded by php code.
    Apparently it's possible to insert php into it, because there's a plugin that let's you do it. Now the plugin is simply grabbing the area you defined as PHP and shoving it back through the interpreter, so there's no reason that this can't be the default behavior.

    @Arantor said in Wordpress.... I hate you.:

    And before you start quoting your PHP and C# are interchangeable, fuck off they are not because C# is not runtime interpreted on a server.

    Never said they were.

    I'm simply saying that

    1. There's no reason that we have to use PHP, specifically, to do the kind of thing that Wordpress is doing.
    2. C# can be manipulated to execute code on the server at run time, because it includes a C# compiler. There are plenty of C# script programs out there because it's a handful of lines of code to make one. I'm not saying this is currently viable as a replacement. I'm just saying it doesn't have to be built on PHP.


  • @xaade said in Wordpress.... I hate you.:

    so there's no reason that this can't be the default behavior

    Yeah, let's just let our users write blog posts that can read and write arbitrary files on the server. That can't go wrong in any way!



  • @ben_lubar Don't remind me of a time when I actually had to write a runtime C# interpreter in C# because of "requirements".


  • Discourse touched me in a no-no place

    @Arantor said in Wordpress.... I hate you.:

    C# is not runtime interpreted on a server

    I am so tempted to do something unwise now…



  • @xaade said in Wordpress.... I hate you.:

    You're editing a file. A file that's going into the database. That will be loaded by php code.

    I’m far from an expert, but wouldn’t that depend on the way it outputs the HTML that it pulls from the database? If it does stuff like process WordPress shortcodes, strip illegal tags, etc. and writes the result to output, any PHP in it wouldn’t ever be executed — you’d probably see it appear inline in your browser instead, assuming it wouldn’t get stripped out by WordPress.

    OTOH if it basically does include() on it, then you’d be right and the PHP on a page would get run by the server. However, since it doesn’t (I tried once), I’d say this isn’t what actually happens.

    Apparently it's possible to insert php into it, because there's a plugin that let's you do it.

    My guess is those plugins work by eval()ing the code you give them and returning the result as the plugin’s output.


  • sockdevs

    @xaade Jesus, you don't get it, do you?

    The main reason Wordpress has traction is because of the availability of places to run it. No other language is as easy to get hosting for.

    You don't have to use PHP, except no other language has the breadth of deployment options and the numbers of incompetent enthusiasts that can cobble shit together to build something.

    Technically, no, it doesn't have to be PHP. But Wordpress is actually kinda easy to use, and hella easy to deploy, so it gets used a lot. Which means PHP it is.


  • Discourse touched me in a no-no place

    @Arantor said in Wordpress.... I hate you.:

    Wordpress is actually kinda easy to use

    If it is locked down so that users can't B•••••m it up, it's not too awful as a way to throw some simple content up and have it not look terrible. But then you can also do that with github pages; markdown is really designed… sorry, hacked together on a Haribo bender with that in mind.


  • Winner of the 2016 Presidential Election

    @dkf said in Wordpress.... I hate you.:

    hacked together on a Haribo bender

    Now I'm hungry. Fuck you, give me gummy bears.


  • mod

    @dkf said in Wordpress.... I hate you.:

    But then you can also do that with github pages

    I'm planning to move one of my sites off Wordpress and onto a markdown-based solution (Jekyll) soon. Should I liveblog the experience?


  • sockdevs

    @dkf using GitHub as a quasi-CMS is orders of magnitude more complex than the typical WP user is able (or inclined to want) to deal with.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.