Skip to content

Instantly share code, notes, and snippets.

View CreativePoweredGeek's full-sized avatar

Russ Kern CreativePoweredGeek

View GitHub Profile
//You can create and update the Channel Entry using below Model query.
//For Creating the Entry :-
$entry = ee('Model')->make('ChannelEntry');
$entry->Channel = $channel;
$entry->site_id = ee()->config->item('site_id');
$entry->author_id = ee()->session->userdata('member_id');
$entry->ip_address = ee()->session->userdata['ip_address'];
$entry->versioning_enabled = $channel->enable_versioning;
$entry->sticky = FALSE;
@CreativePoweredGeek
CreativePoweredGeek / Relationship_inside_grid_field_inside_fluid_example.txt
Last active June 9, 2020 21:36
ExpressionEngine Fluid field with a grid field with a relationship field with multiple channels
{fluid_field}
{fluid_field:grid_field}
{content}
{if '{content:relationship_field:channel_short_name}' == 'channel_a'}
{content:relationship_field}
{content:relationship_field:title}
{content:relationship_field:custom_field_a}
{/content:relationship_field}
{if:elseif '{content:relationship_field:channel_short_name}' == 'channel_b'}
{content:relationship_field}
@CreativePoweredGeek
CreativePoweredGeek / export.html
Created January 11, 2020 12:45
Simple Export to File
{exp:http_header
content_disposition="attachment"
filename="myfile.xls"
content_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
}
<table>
<thead>
<tr>
<th>Entry ID</th>
<th>Title</th>
@CreativePoweredGeek
CreativePoweredGeek / EE_query.html
Last active April 21, 2020 13:13
ExpressionEngine Query Snippets
<!-- This grabs All titles based on uer and channel ID -->
{exp:query sql="SELECT DISTINCT title AS item FROM exp_channels WHERE channel_id = 'your_channel_id' AND author_id = '{logged_in_member_id}'"}
{embed="embeds/product_row" keltec_number="{item:url_slug}"}
{/exp:query}
<!-- This grabs the total entries of a Channel -->
<!-- this can be achieved easier with the {exp:stats} tag but it's good for practive and reference. -->
<!-- Just grab the Channel ID of the desired channel from the Channels Page in the Control Panel -->
@CreativePoweredGeek
CreativePoweredGeek / ee_snippets.html
Last active January 5, 2020 15:14
Useful ExpressionEngine Snippets
<!--Get the count of entries quickly on a channel-->
{exp:stats channel="channel_name"}{total_entries}{/exp:stats}
<!-- This will create an EDIT link that opens the edit window in the Control Panel for this channel entry in a new tab -->
<!-- Must be placed inside an EE Channel Entries tag pair -->
<!-- The user must be a logged in to see it.-->
<!-- Modify visibility by filtering by User Groups.-->
{if logged_in}
<p class="text-center">
@CreativePoweredGeek
CreativePoweredGeek / BSv4 CSS Template
Created January 1, 2019 13:12
This is a modified base template from the BS v4 Docs for custom stylesheet breaks.
/* Universal Styles */
/* Extra small devices (portrait phones, less than 576px) */
/* No media query for `xs` since this is the default in Bootstrap */
/* Small devices (landscape phones, 576px and up) */
@CreativePoweredGeek
CreativePoweredGeek / stylesheet.css
Last active June 17, 2019 08:13
Bootstrap 4 responsive breakpoints css file
// These are the Bootstrap 4 Breakpoints per the Docs
// Google Fonts pre-load
// Extra small devices (portrait phones, less than 576px)
// No media query since this is the default in Bootstrap
// Small devices (landscape phones, 576px and up)
@media (min-width: 576px) {
@CreativePoweredGeek
CreativePoweredGeek / snp_edit_this.html
Created July 31, 2017 11:34
ExpressionEngine 3.x Snippet to place an edit link next to text on the frontend when a user is logged into the control panel.
<!-- This will open the edit window in the Control Panel for this channel entry in a new tab -->
{if logged_in}
<p class="text-center" style="position:absolute;top:0;z-index: 5000;">
<a href="{cp_edit_entry_url}" target="_blank" class="btn btn-default btn-sm btn-edit"><i class="fa fa-pencil-square-o"></i></a>
</p>
{/if}
@CreativePoweredGeek
CreativePoweredGeek / small-device-menu.css
Created July 30, 2017 21:04
CSS changes for making bootstrap responsive menu change on "small" devices
/* This override tells us that any menu in a window LESS than the specified max-width will display the collapsed menu. */
@media (max-width: 960px) {
/* This is for collapsing the menu sooner. */
.navbar-header {
float: none;
}
.navbar-left,.navbar-right {
float: none !important;
}
@CreativePoweredGeek
CreativePoweredGeek / BSv3 CSS Template
Last active January 1, 2019 13:14
My base Bootstrap Responsive CSS File for CSS customizations - BS 3.0
/* Google Fonts pre-load */
/*Most Styles will go here Use Media breaks to modify for larger Devices (Responsive is Mobie-first) */
/* Small devices (tablets, 768px and up) */
@media (min-width: 768px) {
}