Custom PHP code inside Post controls

Stagger Lee
1774 Posts
Stagger Lee posted this 04 December 2015

Was thinking about one idee.
Would it be very difficult for your developers to give us options to insert custom PHP code inside Post controls ?
it could be one option hidden somewhere deep to not disturb all people never using it, it is not so important where it is.

One new option to insert custom PHP code what would replace (PHP) code inside Post header, Post image, Post content, etc....

And maybe one insert option for whole wrapper, sometimes needed when dealing with special PHP code,

A soon Themler detects we entered custom PHP code there, it will ditch all standard PHP code for Title, image, etc..

It could open a way for many, many new possibilities, or ?
As instance styling of repeatable custom fields, custom Posts listings, Homepage layouts, etc...cannot remember all now as whole idee is very fuzzy for me.

Was thinking about one idee. Would it be very difficult for your developers to give us options to insert custom PHP code inside Post controls ? it could be one option hidden somewhere deep to not disturb all people never using it, it is not so important where it is. One new option to insert custom PHP code what would replace (PHP) code inside Post header, Post image, Post content, etc.... And maybe one insert option for whole wrapper, sometimes needed when dealing with special PHP code, A soon Themler detects we entered custom PHP code there, it will ditch all standard PHP code for Title, image, etc.. It could open a way for many, many new possibilities, or ? As instance styling of repeatable custom fields, custom Posts listings, Homepage layouts, etc...cannot remember all now as whole idee is very fuzzy for me.
Vote to pay developers attention to this features or issue.
3 Comments
Order By: Standard | Newest
Stagger Lee
1774 Posts
Stagger Lee posted this 04 December 2015

Here is just one example. I managed to tweak this code inside and around Bootstrap row/columns classes, but header/title needs manual CSS code, and some other things. Post controls would tweak this much more elegant and give us "More styles" options in Themler.

<?php global="" $post;="" $posts="get_field('related_articles');" if="" ($posts)="" {=""?>
    <p>
    <?php foreach($posts="" as="" $post)="" {="" setup_postdata($post);=""?>
        <h3 class="related-title"><a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php the_title();=""?></a></h3>
       <div class="related-thumbnail"><a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php echo="" get_the_post_thumbnail(="" $post_id,="" 'thumbnail');=""?></a></div>
       <?php remove_filter(="" 'the_excerpt',="" 'sharing_display',="" 19="" );=""?>
       <div class="related-meta"><span class="dashicons dashicons-admin-users"></span> <?php the_author_posts_link();=""?> <span class="dashicons dashicons-calendar-alt"></span> <?php the_time('f="" js,="" y');=""?> <span class="dashicons dashicons-visibility"></span> <?php if(function_exists('the_views'))="" {="" the_views();="" }=""?></div>
<div class="related-taxonomy"><span class="dashicons dashicons-portfolio"></span> <?php the_category(',="" ');=""?> <?php edit_post_link(__('{edit}'),="" '');=""?></div>
    <?php }="" end="" for="" each="" loop="" wp_reset_postdata();="" restores="" wp="" post="" data=""?>
    </p>
    <hr>
<?php }="" end="" if=""?>

After inserting Bootstrap classes is like this. Still not perfect and need more tweaking. Specially if titles are to long.
It works fine for now. It is one special Advanced Custom Fields field used as manually decided related articles under Post content.

<div class=" bd-layoutcontainer-74">
    <div class="bd-container-inner">
        <div class="container-fluid">
            <div class="row


 bd-row-flex


 bd-row-align-top


                ">
<?php $posts="get_field('related_articles');" if="" ($posts)="" {=""?>
    <?php foreach($posts="" as="" $post)="" {="" setup_postdata($post);=""?>
    <div class=" 
 col-sm-8">
    <div class="bd-layoutcolumn-167"><div class="bd-vertical-align-wrapper">
        <h3 class="related-title"><a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php the_title();=""?></a></h3>
        <div class="related-thumbnail"><a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php echo="" get_the_post_thumbnail(="" $post_id,="" 'thumbnail');=""?></a></div>
       </div>
</div>
</div>
    <?php }="" end="" for="" each="" loop="" wp_reset_postdata();="" restores="" wp="" post="" data=""?>
<?php }="" end="" if=""?>
</div>
</div>
</div>
</div>

Here is just one example. I managed to tweak this code inside and around Bootstrap row/columns classes, but header/title needs manual CSS code, and some other things. Post controls would tweak this much more elegant and give us "More styles" options in Themler. <?php global="" $post;="" $posts="get_field('related_articles');" if="" ($posts)="" {=""?> <p> <?php foreach($posts="" as="" $post)="" {="" setup_postdata($post);=""?> <h3 class="related-title"><a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php the_title();=""?></a></h3> <div class="related-thumbnail"><a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php echo="" get_the_post_thumbnail(="" $post_id,="" 'thumbnail');=""?></a></div> <?php remove_filter(="" 'the_excerpt',="" 'sharing_display',="" 19="" );=""?> <div class="related-meta"><span class="dashicons dashicons-admin-users"></span> <?php the_author_posts_link();=""?> <span class="dashicons dashicons-calendar-alt"></span> <?php the_time('f="" js,="" y');=""?> <span class="dashicons dashicons-visibility"></span> <?php if(function_exists('the_views'))="" {="" the_views();="" }=""?></div> <div class="related-taxonomy"><span class="dashicons dashicons-portfolio"></span> <?php the_category(',="" ');=""?> <?php edit_post_link(__('{edit}'),="" '');=""?></div> <?php }="" end="" for="" each="" loop="" wp_reset_postdata();="" restores="" wp="" post="" data=""?> </p> <hr> <?php }="" end="" if=""?> After inserting Bootstrap classes is like this. Still not perfect and need more tweaking. Specially if titles are to long. It works fine for now. It is one special Advanced Custom Fields field used as manually decided related articles under Post content. <div class=" bd-layoutcontainer-74"> <div class="bd-container-inner"> <div class="container-fluid"> <div class="row bd-row-flex bd-row-align-top "> <?php $posts="get_field('related_articles');" if="" ($posts)="" {=""?> <?php foreach($posts="" as="" $post)="" {="" setup_postdata($post);=""?> <div class=" col-sm-8"> <div class="bd-layoutcolumn-167"><div class="bd-vertical-align-wrapper"> <h3 class="related-title"><a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php the_title();=""?></a></h3> <div class="related-thumbnail"><a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php echo="" get_the_post_thumbnail(="" $post_id,="" 'thumbnail');=""?></a></div> </div> </div> </div> <?php }="" end="" for="" each="" loop="" wp_reset_postdata();="" restores="" wp="" post="" data=""?> <?php }="" end="" if=""?> </div> </div> </div> </div>
Support Team
Support Team posted this 12 February 2016

Hello Stagger Lee,
I'm terribly sorry for delay in response.
We have discussed the proposal with developers. In fact there's no need for new control or option in Themler. It's enough to remove control which code you'd like to replace and add CMS Code control with your custom code

Regards,
Aileen

Hello Stagger Lee, I'm terribly sorry for delay in response. We have discussed the proposal with developers. In fact there's no need for new control or option in Themler. It's enough to remove control which code you'd like to replace and add CMS Code control with your custom code Regards, Aileen
Stagger Lee
1774 Posts
Stagger Lee posted this 12 February 2016

I know now Aileeen. Was naive thinking it would be possible to hijack wp_query loop this way. But it is not possible. You can ignore this topic. Anyway I have now all snippets for CMS code inside Post controls. Advice to other Users, have them somewhere to be able to use them without going to Google all the time and losing hours on it.

Seems as I opened this topic when CMS code control was not able to be inserted between Post controls. But I dont remember. Not important anymore.

I know now Aileeen. Was naive thinking it would be possible to hijack wp_query loop this way. But it is not possible. You can ignore this topic. Anyway I have now all snippets for CMS code inside Post controls. Advice to other Users, have them somewhere to be able to use them without going to Google all the time and losing hours on it. Seems as I opened this topic when CMS code control was not able to be inserted between Post controls. But I dont remember. Not important anymore.
You must log in or register to leave comments