Advertisement:

Author Topic: WP and SMF bound by appearance only, by request.  (Read 1563 times)

Offline drewactual

  • Jr. Member
  • **
  • Posts: 339
    • College Football Fan Site CFB51
WP and SMF bound by appearance only, by request.
« on: July 10, 2018, 09:43:41 AM »

by the way... i don't understand the angst with WP... I use WP as the publisher as nothing anywhere else does as good a job from the users perspective, and i firmly believe SMF is the better of the forum engine softwares... they mate well- not in backend interaction, but can be styled to look the same to users, and that is the more important aspect.  a WP landing with information and a patch to comment in the forum is the ticket, in my humble opinion, and crucial to developing community...

Are you able to elaborate on this please? Perhaps in a new post - a how to or examples of matching a wordpress site and SMF site visually?.

I would also be interested in this discussion. Don't have the skill set for detail changes in CSS or SMF template but often wanted to combine features & plugins available in WP (nothing similar in SMF mods) to add features information to the overall site with the forum at the core.


prompted this (hopefully) brief discussion, and I drug it over here to keep that thread clear of a pretty significant hijack. 


brief explanation as to why I'm thinking WP is an important piece of a puzzle for those of us kick starting sites:

As i said in the 'other' thread, Forum's, it's been my experience, don't bring traffic without substance.  in this age of information being readily available the consistent 'fly trap' is content.  Content can be collected on a forum heck yeah- but by its very nature it doesn't have the 'authority' that publishing does... Publishing is better done with WP.  There are tools available to draft and launch and get your articles posting all over the web- which is significant for us SMF 'forum at heart' folks as we push our comments over to our forums.  If done strategically with tact, a community forms and boom- we're 'launched'.  enough of this, though.

WP is a simple engine/machine, too.  it's structure is easily deconstructed so folks like us can 'see what makes it tick', and this is useful for what i suggest is the easiest way to go about VISUALLY integration with SMF.  WP can be frustrating, though, when you see how authors have gone around their elbow to arrive at their arses with their coding, and while SMF authors cut to the chase.  both are well commented, though, and anyone with understanding of php and html can make this happen with little effort... oh, you can make it complicated let there be little doubt, but..... it's only as complicated as you make it.  complication, however, ought not be confused with 'time'.  if you want to do this right, it's going to take time.


prepping SMF:

SMF's magic is a simple templating process that rallies around the index.template in whatever theme you use.  there isn't much to it, really, but it's importance can't be understated as it frames the users experience.  for all practical purposes, the index.template get's the ball rolling insofar as required scripts and calls to CSS in it's head, and then throws out the header, followed by the body.  the 'bulk' is depending on what page you're requesting be it the index (entry) or a board (board.index) or perhaps the posts (display.index)- it all is 'framed' by the index template.  we want to introduce WP features, possibly, to this page so as to enhance the illusion of integration... this is done by adding to your smf/themes/theme/index.template a simple line that allows WP to operate 'outside the loop'. 

you'll want to add to your index.template
Code: [Select]
//Load WP  API
require '/home/user/www/blog/wp-load.php';

but... that just isn't good enough... first off, it 'requires', it doesn't just include... this means if your WP coughs, it takes SMF down with it.  so a better use is:

Code: [Select]
//Load WP  API
include  '/home/user/www/blog/wp-load.php';

it's better to do this as soon as you can... but it's also better to do this w/o interfering with SMF if possible.  after the magic SMF kickoff of:
Code: [Select]
function template_init()and it's subsequent code, you'll want to plant the WP call... so let's just say:

before:
Code: [Select]
// The main sub template above the content.
function template_html_above()
{
add:
Code: [Select]
include  '/home/user/www/blog/wp-load.php';

boom... now you're ready to use some WP functions inside of SMF.  What you use is up to you.  It's important to notice the call to wp asks for the 'functions' and NONE of the theme elements such as templates and css.  you're going to want to add those lines too if you need them... let's say you do?  find in your SMF index.template the section in the header that requests css- and add an additional line requesting a look at your WP css.  Or, better yet, combine the CSS's and then minify them.... that's a topic for another discussion, though.

prepping WP to use SMF functions:

 
this is the difficult part... it's SO difficult, i recommend it be used only by experts with decades of practice.  for those of you bold enough to venture into this uncharted universe, know that the rewards are worth the effort.  here it is... in it's entirety... ready?

in your WP theme part that controls the head of the page, and before anything else is kicked off (first line), add:
Code: [Select]
<?php require("SSI.php"); ?>

this little line allows you access to a plethora of outputs of SMF functions... a list and how to do it is is here ....

another good idea to add to your WP file that controls the head is to call to your SMF theme's CSS. 

making them blend, blurring the lines, and where your time will be spent:


now we're down to talking about HTML, basically. 

right click your SMF homepage and look at the source code.  print it.  learn it.  break out the highlighter and color the major DIV#ID's, and DIV.classes... discover your structure in a building block fashion. 

do the same with your WP index.

break out a pencil and paper and draw out how you'd like the page to look... figure out the divisions you'll need to 'share' between the two... since you've called both CSS files in both SMF and WP, (or maybe you combined them and minified them?) you have access to their structure and presentation from both SMF and WP. whoop!!!!

you now get to toy around until you find a path that makes sense- hopefully one that doesn't make SMF rely on WP or WP rely on SMF (one doesn't break the other, and one of the reasons the preference is to 'include' rather than 'require' when/where you can). 


here is a spoiler and trick to consider:

both systems use templates.  why not jump in that party?

there are two ways to go about this... one is simple, the other more involved, but both work and work well. 

in separate directories located outside both SMF and WP, i have made (with success) php files with simple single functions.  as a for instance, there is one called 'display-header-page' and i'll give you one guess what it does? another that does sidebar adverts, for instance, and called 'display-sidebar-adverts'... guess what it does?  there is a display-footer, a display-this and a display-that... all of which combine to offer a page that looks just like the webpage but is void of content (other than what is added in those files)...

the involved manner to blend the two engines is to add lines in appropriate locations ON BOTH SMF index.template AND WP's 'header control file' such as:
Code: [Select]
<?php include('.././overarching-site-template-files/display-header.php'); ?>
the simple manner to achieve the same thing is to destroy anything and everything to do with the index.template and the wp's template output's controls FRAMING, and build your own.... an absolutely rudimentary example is something like this for both WP and SMF:

in your SMF index.template, and right after the head closing tag (/head) add something like:
Code: [Select]
<?php include('.././overarching-site-template-files/display-header.php'); ?>

and right before the closing of html (/html) add something like:
Code: [Select]
<?php include('.././overarching-site-template-files/display-footer.php
obviously, in between at various locations you'll want to add your external include for sidebars, ect. 

you'll do the same thing for your WP template files. 

the include files will contain your 'form', NOT your 'function'.  the function remains with the engines, be it WP or SMF.   you're going to want to remove as much style and 'form' from both SMF and WP as you can, and control them with your own external 'site-template' files.... basically, you're building a template system that's all your own using simple php includes and html outputs from within those php files, and forcing SMF and WP to operate inside that framework, and without screwing with the functions of either SMF or WP.... you can absolutely use functions 'outside the loop' for WP functions inside SMF, or use SSI to add output of SMF functions inside of WP- but i recommend you do that sparingly so as one is limited in its ability to 'break' the other. 

if done right, it's seamless.  users just won't know.  the 'giveaway' on my site is the top bar where the cookies (login) don't translate from WP to SMF or vice-versa.....





some good functions from WP to use in SMF (or better yet one of those external php files called into SMF in the index.template) :

Code: [Select]
~open your html output constraints here such as controlling (visually) div's, spans, ect~
<?php
function get_post_excerpt$post_id$excerpt_length null$excerpt_more null$more_link true ) {
$post get_post$post_id );
if ( null === $excerpt_length ) {
$excerpt_length apply_filters'excerpt_length'55 );
}
if ( $post->post_excerpt ) {
$excerpt $post->post_excerpt;
} else {
$excerpt strip_shortcodes$post->post_content );
$excerpt apply_filters'the_content'$excerpt );
$excerpt str_replace']]>'']]&gt;'$excerpt );
$original_word_count str_word_countstrip_tags$excerpt ) );
$excerpt wp_trim_words$excerpt$excerpt_length'' );
$is_trimmed_excerpt str_word_count$excerpt ) < $original_word_count;
}
if ( null === $excerpt_more ) {
$excerpt_more apply_filters'excerpt_more''&hellip;' );
}
$excerpt_more = empty( $is_trimmed_excerpt ) ? '' $excerpt_more;
$excerpt apply_filters'get_post_excerpt_excerpt'$excerpt $excerpt_more );
if ( false === $more_link ) {
return $excerpt;
} else {
$more_link sprintf'<a href="%s" class="more-link read-more-link">%s</a>',
get_the_permalink$post->ID ),
apply_filters'get_post_excerpt_read_more_text''Read More' )
);
}
return $excerpt apply_filters'get_post_excerpt_read_more_link'$more_link );
}
?>

~close your div's here~
<?php wp_reset_query(); ?>

this will add a WP post to an SMF page, or to the page (is it your site-template framework?) you call it to. 



anyway, this has been a down and dirty explanation to follow up on the two folks who asked.  I hope it helps others, and i'll be happy to answer any questions if there are any. 

to see how i blended a page of mine, follow the link in my sig- SMF is up front in this instance, and the 'publisher', i.e WP, is available in the top menu.
 
https://www.cfb51.com is a College Football Fan Site, Store, and Publisher, launched in July of 2017

Online vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 20,556
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: WP and SMF bound by appearance only, by request.
« Reply #1 on: July 10, 2018, 12:04:03 PM »
Thanks for the guide. Should help a bunch of people
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline confuseamuse

  • Jr. Member
  • **
  • Posts: 145
Re: WP and SMF bound by appearance only, by request.
« Reply #2 on: July 10, 2018, 12:05:36 PM »
if done right, it's seamless.  users just won't know.  the 'giveaway' on my site is the top bar where the cookies (login) don't translate from WP to SMF or vice-versa.....

Can't you use SSI to solve that problem?

Offline drewactual

  • Jr. Member
  • **
  • Posts: 339
    • College Football Fan Site CFB51
Re: WP and SMF bound by appearance only, by request.
« Reply #3 on: July 10, 2018, 12:15:55 PM »
if done right, it's seamless.  users just won't know.  the 'giveaway' on my site is the top bar where the cookies (login) don't translate from WP to SMF or vice-versa.....

Can't you use SSI to solve that problem?

i can, but i don't see it as a problem... if it were something of concern in my application of this merger, it would grant access to both SMF and WP via one login- or the bridge, if you would... i don't want a bridge... the two engines provide a distinct function as i'm presenting it.  there is no need for SMF users to have access to WP in this case, and contributor's are aware they have to log into the publisher to fiddle there. 

this time of year, again in my personal application, there is only one original WP post published, as everything else there is aggregated articles... that will change in the coming weeks as the season approaches.  for that, instead of being overly complicated about it (I could make a script that opens a new SMF thread/topic for every specific category of WP post automated) i simply post up the article (or a contributor does) and then post a link to a pre-positioned SMF board and topic to support it's comments....

the single original article posted now is super long so i didn't do it in this instance, but a copy of the article in the opening topic post, as a practice, is helpful or users to pick it apart in the comments (using quote).   

 
https://www.cfb51.com is a College Football Fan Site, Store, and Publisher, launched in July of 2017

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 69,452
    • StoryBB/StoryBB on GitHub
Re: WP and SMF bound by appearance only, by request.
« Reply #4 on: July 12, 2018, 08:10:39 AM »
Other than two systems that both require patching, and a not entirely fluid experience between the two, what does this give you that a portal can’t?
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 57,221
  • Gender: Male
    • Kindred-999 on GitHub
Re: WP and SMF bound by appearance only, by request.
« Reply #5 on: July 12, 2018, 08:41:04 AM »
and, if you say "a blog" - let me point you to Sesquipedalian's site....
https://www.simplemachines.org/community/index.php?topic=558772.0

all done within SMF.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline shinglis

  • Semi-Newbie
  • *
  • Posts: 41
    • Somersetroadend
Re: WP and SMF bound by appearance only, by request.
« Reply #6 on: July 12, 2018, 09:45:29 AM »
Thanks for this. Have you had any experience with WP packages or just the core features.  I'm guessing is the packages setup on a WP page then the page integrated should work.

Offline drewactual

  • Jr. Member
  • **
  • Posts: 339
    • College Football Fan Site CFB51
Re: WP and SMF bound by appearance only, by request.
« Reply #7 on: July 12, 2018, 09:49:11 AM »
Other than two systems that both require patching, and a not entirely fluid experience between the two, what does this give you that a portal can’t?

tools.  like it or not WP is the widest used open source engine on the web.  there are tools galore, but more importantly (in my case) it's the portability.  i can connect with other WP sites and swap articles, share links, trade lists, and all automated as they are using WP and there is a tool for it- where as SMF can't do that (or it hasn't been developed to my knowledge) and there are only a small fraction of SMF sites as compared to WP- making 'share' transactions easier.  With WP I can (and have/do) run full out stores with resident cc processing and presentation 'out of the box' where as any SMF shop looks like it came out of the nineties without tons of effort coding php and css.  WP has tools that auto-post to social media and updates as the user dictates, automatically, and in a format prescribed by the admin- SMF doesn't have anything approximating that i've encountered.  it could be done, yeah, but- i could either spend my time and effort drafting such a thing (which is pressing any semblance of skill i have with such matters) but 'out of the box' WP has it.  I can even post items for sale on social media using tools already available via WP.  and possibly more importantly, i can pull from API's entire current/updated product listings complete with images and prices adjusted for my retail margin using well tested and validated, not to mention thoroughly supported, plugins for inventory management and automated ordering from those distributors- making a webstore an upfront effort on my part, and requiring only mild management/supervision once bugs are kicked out of it..... again... out of the box. 

don't get me wrong... I'd much rather be able to do all of this with just one engine.  SMF can't do it.  Until there are substantial 'listeners' for original content offered by my writers ensuring their articles get as much publicity as possible, which would have to be designed in a manner the metadata is in the right place as well as images and text itself- which is the default of WP... again, because of the sheer widespread use of WP, all newsreels accept post/articles as-is straight out of the hopper.  the last thing i need is some clumsy script that imitates WP output to goof, and getting the articles blackballed by the distributor.

insofar as i am concerned, there is no better forum than SMF.  for enterprises that rely heavily on community, SMF will always be the choice for that support.  on the page i most often goof around with, the 'community' (aka forum) is the primary driver.  without it, the page would be nothing.  the extreme value of that particular forum which is something i inherited due to a bankruptcy of a major company and CBSInteractive buying them out of chapter11- basically handing me the forum aspect of the original... i know the crowd well- for more that 17 years- and i know their interests and hobbies... it allows me to secure vendors that cater to their interests, launch a website selling said items/families of items, and direct market to them.  the power of community cannot be understated- and SMF is the glue that keeps it together.  It also allows me to advertise for affiliate markets, which basically covers my operating expenses of leasing a dedicated server.  read: one site and it's traffic, which is a community/forum, pays the overhead for the entire operation.  THAT is something WP CAN'T do, and it would be extremely------ optimistic----- to ever attempt such a thing with WP. 

edited to add: this isn't just a guess, either... google analytics demonstrates a bounce rate of 17% overall for my primary community, and an average session of exceeding ten minutes for the core forum... i don't and have never owned a WP site that has anything better than a 40% bounce rate, and an average session exceeding 90 seconds... however, for entry into my pages that weren't direct linked, WP rules by a wide wide margin. 

you asked what it gives me a portal can't... ^that.


and, if you say "a blog" - let me point you to Sesquipedalian's site....
https://www.simplemachines.org/community/index.php?topic=558772.0

all done within SMF.

I've been watching that thread for some time- and the work accomplished there is impressive and presented in a very tasteful way.  they gots skillz, yo.  I love how the boards are almost a 'second thought' like "oh yeah- here is a place to talk it up!" after rendering their mission statement and cause... very nicely done.  However, in the case i find myself, I want the forum to be just that- straight forward and easily found, navigated, and used.  Likewise i want the 'publisher' (in one instance) to be the defacto purpose of its page.  The store, likewise... all of this has purpose, but for an operation like Sesquipedalian's?  It's perfect, and a true thing of beauty.
https://www.cfb51.com is a College Football Fan Site, Store, and Publisher, launched in July of 2017

Offline drewactual

  • Jr. Member
  • **
  • Posts: 339
    • College Football Fan Site CFB51
Re: WP and SMF bound by appearance only, by request.
« Reply #8 on: July 12, 2018, 10:01:12 AM »
Thanks for this. Have you had any experience with WP packages or just the core features.  I'm guessing is the packages setup on a WP page then the page integrated should work.

by plug-ins I am assuming your speaking of things that will render totally different such as a store? 

i guess it really doesn't matter if that is it, but... i've gone through every output and matched enough that the rendering is almost transparent to the user.  that includes the core package and all themes and plugins.  usually, i choose a theme that has the basic structure that will compliment, and make a child-theme out of it... then i chop the crap out of the child until it renders how i'm happy with it. 

i offered up earlier that you can make your own CMS and force WP and SMF to operate inside of it, but.... I most often choose not to do that instead just making the sites render very similar via themes.  not only are all my instances where these are 'shared' running on different db's, but i want them as stand alone as possible in the case an update to one or the other disrupts what i'm trying to accomplish.
https://www.cfb51.com is a College Football Fan Site, Store, and Publisher, launched in July of 2017