How to add osclass custom page in themes
How to add osclass custom page in themes

Page are an integral part of any website, with the help of pages we pass on information about the website to our users. Besides login, signup’s, admin panel and  posting ads on osclass website we can add pages to our sites. Osclass has WYSIWYG ( what you see is what you get ) editor for building and adding pages.

How to add a page in osclass?

    1. Login to you admin panel at www.yourwebsite.com/oc-admin/
    2. On the left hand side menu click on PAGES ( it might be hidden under see more menu at the bottom ).
    3. Beside manage pages title click on add new button.
    4. add osclass page
      add osclass page
    5. Enter the title for your page.
    6. what is internal name?  internal name will appear in the URL if you have enabled
      friendly urls Eg : If we have entered Hello world as the inter name, when you visit your page the url of the page will look something like this http://www.osclass.dev/hello-world-p26. If you are adding your about page the the set you internal name to about us and the url will look something like this http://www.osclass.dev/about-us-p27.
    7. The p26 and the p27 appended to the url is the page ID number. Osclass will automatically append the id number.
    8. Then add the page description. You can use the WYSIWYG editor to add / edit the content of the page.

Osclass custom page

Osclass custom page is mostly not a part of any free or premium theme. You can ask Osclass developers to add a new custom page for you. For instance you don’t want to use the WYSIWYG editor to add your about page instead you want a beautiful page with graphics and your own design.

  • Go to Add new from the Pages tab on the admin panel.
  • Enter a custom internal name, for example about_us
  • Enter a tittle, body could be left empty
  • Create your custom file, call it page-about_us.php
  • Upload it to your theme folder.

All your about page design goes inside page-about_us.php file. This is how a page.php file content looks like

<?php 
  osc_add_hook('header','bender_nofollow_construct');
  bender_add_body_class('page');
  osc_current_web_theme_path('header.php') ;
?>
 <h1><?php echo osc_static_page_title(); ?></h1>
 <?php echo osc_static_page_text(); ?>
 <?php osc_current_web_theme_path('footer.php') ; ?>

  1. osc_current_web_theme_path('header.php') ; line will add the header of the theme you have uploaded the file to.
  2. <?php echo osc_static_page_title(); ?> line will print our the title you have set for the page when you added the page
  3. <?php echo osc_static_page_text(); ?> line will print out the content of the page you have added with the WYSIWYG editor.
  4. <?php osc_current_web_theme_path(‘footer.php’) ; ?> line will add the footer of the theme

Now instead of the <?php echo osc_static_page_text(); ?> you can add your custom design. Or you can add your design and make the content flexible like

<?php osc_add_hook('header','bender_nofollow_construct');

bender_add_body_class('page');
 osc_current_web_theme_path('header.php') ;
?>
<h1><?php echo osc_static_page_title(); ?></h1>

<div class="my-design">
<!-- Your design goes in here. Something like this-->
</div>

<?php echo osc_static_page_text(); ?> //you can still print the content from the admin panel

<div class="my-second-design">
<!-- Your design goes in here. Something like this-->
</div>

<?php osc_current_web_theme_path('footer.php') ; ?>

If you have and question then do comment below.

LEAVE A REPLY